home *** CD-ROM | disk | FTP | other *** search
/ Language/OS - Multiplatform Resource Library / LANGUAGE OS.iso / gnu / termcap.lha / termcap-1.2 / texinfo.tex (.txt) < prev    next >
LaTeX Document  |  1993-03-23  |  129KB  |  3,132 lines

  1. %% TeX macros to handle texinfo files
  2. %   Copyright (C) 1985, 86, 88, 90, 91, 92, 1993 Free Software Foundation, Inc.
  3. %This texinfo.tex file is free software; you can redistribute it and/or
  4. %modify it under the terms of the GNU General Public License as
  5. %published by the Free Software Foundation; either version 2, or (at
  6. %your option) any later version.
  7. %This texinfo.tex file is distributed in the hope that it will be
  8. %useful, but WITHOUT ANY WARRANTY; without even the implied warranty
  9. %of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  10. %General Public License for more details.
  11. %You should have received a copy of the GNU General Public License
  12. %along with this texinfo.tex file; see the file COPYING.  If not, write
  13. %to the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139,
  14. %USA.
  15. %In other words, you are welcome to use, share and improve this program.
  16. %You are forbidden to forbid anyone else to use, share and improve
  17. %what you give them.   Help stamp out software-hoarding!
  18. \def\texinfoversion{2.104}
  19. \message{Loading texinfo package [Version \texinfoversion]:}
  20. \message{}
  21. % Print the version number if in a .fmt file.
  22. \everyjob{\message{[Texinfo version \texinfoversion]}\message{}}
  23. % Save some parts of plain tex whose names we will redefine.
  24. \let\ptexlbrace=\{
  25. \let\ptexrbrace=\}
  26. \let\ptexdots=\dots
  27. \let\ptexdot=\.
  28. \let\ptexstar=\*
  29. \let\ptexend=\end
  30. \let\ptexbullet=\bullet
  31. \let\ptexb=\b
  32. \let\ptexc=\c
  33. \let\ptexi=\i
  34. \let\ptext=\t
  35. \let\ptexl=\l
  36. \let\ptexL=\L
  37. \def\tie{\penalty 10000\ }     % Save plain tex definition of ~.
  38. \message{Basics,}
  39. \chardef\other=12
  40. % If this character appears in an error message or help string, it
  41. % starts a new line in the output.
  42. \newlinechar = `^^J
  43. % Ignore a token.
  44. \def\gobble#1{}
  45. \hyphenation{ap-pen-dix}
  46. \hyphenation{mini-buf-fer mini-buf-fers}
  47. \hyphenation{eshell}
  48. % Margin to add to right of even pages, to left of odd pages.
  49. \newdimen \bindingoffset  \bindingoffset=0pt
  50. \newdimen \normaloffset   \normaloffset=\hoffset
  51. \newdimen\pagewidth \newdimen\pageheight
  52. \pagewidth=\hsize \pageheight=\vsize
  53. % Sometimes it is convenient to have everything in the transcript file
  54. % and nothing on the terminal.  We don't just call \tracingall here,
  55. % since that produces some useless output on the terminal.
  56. \def\gloggingall{\begingroup \globaldefs = 1 \loggingall \endgroup}%
  57. \def\loggingall{\tracingcommands2 \tracingstats2 
  58.    \tracingpages1 \tracingoutput1 \tracinglostchars1 
  59.    \tracingmacros2 \tracingparagraphs1 \tracingrestores1 
  60.    \showboxbreadth\maxdimen\showboxdepth\maxdimen
  61. %---------------------Begin change-----------------------
  62. %%%% For @cropmarks command.
  63. % Dimensions to add cropmarks at corners Added by P. A. MacKay, 12 Nov. 1986
  64. \newdimen\cornerlong \newdimen\cornerthick
  65. \newdimen \topandbottommargin
  66. \newdimen \outerhsize \newdimen \outervsize
  67. \cornerlong=1pc\cornerthick=.3pt    % These set size of cropmarks
  68. \outerhsize=7in
  69. %\outervsize=9.5in
  70. % Alternative @smallbook page size is 9.25in
  71. \outervsize=9.25in
  72. \topandbottommargin=.75in
  73. %---------------------End change-----------------------
  74. % \onepageout takes a vbox as an argument.  Note that \pagecontents
  75. % does insertions itself, but you have to call it yourself.
  76. \chardef\PAGE=255  \output={\onepageout{\pagecontents\PAGE}}
  77. \def\onepageout#1{\hoffset=\normaloffset
  78. \ifodd\pageno  \advance\hoffset by \bindingoffset
  79. \else \advance\hoffset by -\bindingoffset\fi
  80. {\escapechar=`\\\relax % makes sure backslash is used in output files.
  81. \shipout\vbox{{\let\hsize=\pagewidth \makeheadline} \pagebody{#1}%
  82. {\let\hsize=\pagewidth \makefootline}}}%
  83. \advancepageno \ifnum\outputpenalty>-20000 \else\dosupereject\fi}
  84. %%%% For @cropmarks command %%%%
  85. % Here is a modification of the main output routine for Near East Publications
  86. % This provides right-angle cropmarks at all four corners.
  87. % The contents of the page are centerlined into the cropmarks,
  88. % and any desired binding offset is added as an \hskip on either
  89. % site of the centerlined box.  (P. A. MacKay, 12 November, 1986)
  90. \def\croppageout#1{\hoffset=0pt % make sure this doesn't mess things up
  91. {\escapechar=`\\\relax % makes sure backslash is used in output files.
  92.          \shipout
  93.          \vbox to \outervsize{\hsize=\outerhsize
  94.                  \vbox{\line{\ewtop\hfill\ewtop}}
  95.                  \nointerlineskip
  96.                  \line{\vbox{\moveleft\cornerthick\nstop}
  97.                        \hfill
  98.                        \vbox{\moveright\cornerthick\nstop}}
  99.                  \vskip \topandbottommargin
  100.                  \centerline{\ifodd\pageno\hskip\bindingoffset\fi
  101.             \vbox{
  102.             {\let\hsize=\pagewidth \makeheadline}
  103.             \pagebody{#1}
  104.             {\let\hsize=\pagewidth \makefootline}}
  105.             \ifodd\pageno\else\hskip\bindingoffset\fi}
  106.          \vskip \topandbottommargin plus1fill minus1fill
  107.                  \boxmaxdepth\cornerthick
  108.                  \line{\vbox{\moveleft\cornerthick\nsbot}
  109.                        \hfill
  110.                        \vbox{\moveright\cornerthick\nsbot}}
  111.                  \nointerlineskip
  112.                  \vbox{\line{\ewbot\hfill\ewbot}}
  113.   \advancepageno 
  114.   \ifnum\outputpenalty>-20000 \else\dosupereject\fi}
  115. % Do @cropmarks to get crop marks
  116. \def\cropmarks{\let\onepageout=\croppageout }
  117. \def\pagebody#1{\vbox to\pageheight{\boxmaxdepth=\maxdepth #1}}
  118. {\catcode`\@ =11
  119. \gdef\pagecontents#1{\ifvoid\topins\else\unvbox\topins\fi
  120. \dimen@=\dp#1 \unvbox#1
  121. \ifvoid\footins\else\vskip\skip\footins\footnoterule \unvbox\footins\fi
  122. \ifr@ggedbottom \kern-\dimen@ \vfil \fi}
  123. % Here are the rules for the cropmarks.  Note that they are
  124. % offset so that the space between them is truly \outerhsize or \outervsize
  125. % (P. A. MacKay, 12 November, 1986)
  126. \def\ewtop{\vrule height\cornerthick depth0pt width\cornerlong}
  127. \def\nstop{\vbox
  128.   {\hrule height\cornerthick depth\cornerlong width\cornerthick}}
  129. \def\ewbot{\vrule height0pt depth\cornerthick width\cornerlong}
  130. \def\nsbot{\vbox
  131.   {\hrule height\cornerlong depth\cornerthick width\cornerthick}}
  132. % Parse an argument, then pass it to #1.  The argument is the rest of
  133. % the input line (except we remove a trailing comment).  #1 should be a
  134. % macro which expects an ordinary undelimited TeX argument.
  135. \def\parsearg#1{%
  136.   \let\next = #1%
  137.   \begingroup
  138.     \obeylines
  139.     \futurelet\temp\parseargx
  140. % If the next token is an obeyed space (from an @example environment or
  141. % the like), remove it and recurse.  Otherwise, we're done.
  142. \def\parseargx{%
  143.   % \obeyedspace is defined far below, after the definition of \sepspaces.
  144.   \ifx\obeyedspace\temp
  145.     \expandafter\parseargdiscardspace
  146.   \else
  147.     \expandafter\parseargline
  148.   \fi
  149. % Remove a single space (as the delimiter token to the macro call).
  150. {\obeyspaces %
  151.  \gdef\parseargdiscardspace {\futurelet\temp\parseargx}}
  152. {\obeylines %
  153.   \gdef\parseargline#1^^M{%
  154.     \endgroup % End of the group started in \parsearg.
  155.     %
  156.     % First remove any @c comment, then any @comment.
  157.     % Result of each macro is put in \toks0.
  158.     \argremovec #1\c\relax %
  159.     \expandafter\argremovecomment \the\toks0 \comment\relax %
  160.     %
  161.     % Call the caller's macro, saved as \next in \parsearg.
  162.     \expandafter\next\expandafter{\the\toks0}%
  163. % Since all \c{,omment} does is throw away the argument, we can let TeX
  164. % do that for us.  The \relax here is matched by the \relax in the call
  165. % in \parseargline; it could be more or less anything, its purpose is
  166. % just to delimit the argument to the \c.
  167. \def\argremovec#1\c#2\relax{\toks0 = {#1}}
  168. \def\argremovecomment#1\comment#2\relax{\toks0 = {#1}}
  169. % \argremovec{,omment} might leave us with trailing spaces, though; e.g.,
  170. %    @end itemize  @c foo
  171. % will have two active spaces as part of the argument with the
  172. % `itemize'.  Here we remove all active spaces from #1, and assign the
  173. % result to \toks0.
  174. % This loses if there are any *other* active characters besides spaces
  175. % in the argument -- _ ^ +, for example -- since they get expanded.
  176. % Fortunately, Texinfo does not define any such commands.  (If it ever
  177. % does, the catcode of the characters in questionwill have to be changed
  178. % here.)  But this means we cannot call \removeactivespaces as part of
  179. % \argremovec{,omment}, since @c uses \parsearg, and thus the argument
  180. % that \parsearg gets might well have any character at all in it.
  181. \def\removeactivespaces#1{%
  182.   \begingroup
  183.     \ignoreactivespaces
  184.     \edef\temp{#1}%
  185.     \global\toks0 = \expandafter{\temp}%
  186.   \endgroup
  187. % Change the active space to expand to nothing.
  188. \begingroup
  189.   \obeyspaces
  190.   \gdef\ignoreactivespaces{\obeyspaces\let =\empty}
  191. \endgroup
  192. \def\flushcr{\ifx\par\lisppar \def\next##1{}\else \let\next=\relax \fi \next}
  193. %% These are used to keep @begin/@end levels from running away
  194. %% Call \inENV within environments (after a \begingroup)
  195. \newif\ifENV \ENVfalse \def\inENV{\ifENV\relax\else\ENVtrue\fi}
  196. \def\ENVcheck{%
  197. \ifENV\errmessage{Still within an environment.  Type Return to continue.}
  198. \endgroup\fi} % This is not perfect, but it should reduce lossage
  199. % @begin foo  is the same as @foo, for now.
  200. \newhelp\EMsimple{Type <Return> to continue.}
  201. \outer\def\begin{\parsearg\beginxxx}
  202. \def\beginxxx #1{%
  203. \expandafter\ifx\csname #1\endcsname\relax
  204. {\errhelp=\EMsimple \errmessage{Undefined command @begin #1}}\else
  205. \csname #1\endcsname\fi}
  206. % @end foo executes the definition of \Efoo.
  207. \def\end{\parsearg\endxxx}
  208. \def\endxxx #1{%
  209.   \removeactivespaces{#1}%
  210.   \edef\endthing{\the\toks0}%
  211.   \expandafter\ifx\csname E\endthing\endcsname\relax
  212.     \expandafter\ifx\csname \endthing\endcsname\relax
  213.       % There's no \foo, i.e., no ``environment'' foo.
  214.       \errhelp = \EMsimple
  215.       \errmessage{Undefined command `@end \endthing'}%
  216.     \else
  217.       \unmatchedenderror\endthing
  218.     \fi
  219.   \else
  220.     % Everything's ok; the right environment has been started.
  221.     \csname E\endthing\endcsname
  222.   \fi
  223. % There is an environment #1, but it hasn't been started.  Give an error.
  224. \def\unmatchedenderror#1{%
  225.   \errhelp = \EMsimple
  226.   \errmessage{This `@end #1' doesn't have a matching `@#1'}%
  227. % Define the control sequence \E#1 to give an unmatched @end error.
  228. \def\defineunmatchedend#1{%
  229.   \expandafter\def\csname E#1\endcsname{\unmatchedenderror{#1}}%
  230. % Single-spacing is done by various environments.
  231. \newskip\singlespaceskip \singlespaceskip = \baselineskip
  232. \def\singlespace{%
  233. {\advance \baselineskip by -\singlespaceskip
  234. \kern \baselineskip}%
  235. \baselineskip=\singlespaceskip
  236. %% Simple single-character @ commands
  237. % @@ prints an @
  238. % Kludge this until the fonts are right (grr).
  239. \def\@{{\tt \char '100}}
  240. % This is turned off because it was never documented
  241. % and you can use @w{...} around a quote to suppress ligatures.
  242. %% Define @` and @' to be the same as ` and '
  243. %% but suppressing ligatures.
  244. %\def\`{{`}}
  245. %\def\'{{'}}
  246. % Used to generate quoted braces.
  247. \def\mylbrace {{\tt \char '173}}
  248. \def\myrbrace {{\tt \char '175}}
  249. \let\{=\mylbrace
  250. \let\}=\myrbrace
  251. % @: forces normal size whitespace following.
  252. \def\:{\spacefactor=1000 }
  253. % @* forces a line break.
  254. \def\*{\hfil\break\hbox{}\ignorespaces}
  255. % @. is an end-of-sentence period.
  256. \def\.{.\spacefactor=3000 }
  257. % @w prevents a word break.  Without the \leavevmode, @w at the
  258. % beginning of a paragraph, when TeX is still in vertical mode, would
  259. % produce a whole line of output instead of starting the paragraph.
  260. \def\w#1{\leavevmode\hbox{#1}}
  261. % @group ... @end group forces ... to be all on one page, by enclosing
  262. % it in a TeX vbox.  We use \vtop instead of \vbox to construct the box
  263. % to keep its height that of a normal line.  According to the rules for
  264. % \topskip (p.114 of the TeXbook), the glue inserted is
  265. % max (\topskip - \ht (first item), 0).  If that height is large,
  266. % therefore, no glue is inserted, and the space between the headline and
  267. % the text is small, which looks bad.
  268. \def\group{\begingroup
  269.   \ifnum\catcode13=\active \else
  270.     \errhelp = \groupinvalidhelp
  271.     \errmessage{@group invalid in context where filling is enabled}%
  272.   \fi
  273.   % The \vtop we start below produces a box with normal height and large
  274.   % depth; thus, TeX puts \baselineskip glue before it, and (when the
  275.   % next line of text is done) \lineskip glue after it.  (See p.82 of
  276.   % the TeXbook.)  But the next line of text also gets us \parskip glue.
  277.   % Final result: space below is slightly more than space above.
  278.   \def\Egroup{%
  279.     \egroup           % End the \vtop.
  280.     \endgroup         % End the \group.
  281.   \vtop\bgroup
  282.     % We have to put a strut on the last line in case the @group is in
  283.     % the midst of an example, rather than completely enclosing it.
  284.     % Otherwise, the interline space between the last line of the group
  285.     % and the first line afterwards is too small.  But we can't put the
  286.     % strut in \Egroup, since there it would be on a line by itself.
  287.     % Hence this just inserts a strut at the beginning of each line.
  288.     \everypar = {\strut}%
  289.     %
  290.     % We do @comment here in case we are called inside an environment,
  291.     % such as @example, where each end-of-line in the input causes an
  292.     % end-of-line in the output.  We don't want the end-of-line after
  293.     % the `@group' to put extra space in the output.  Since @group
  294.     % should appear on a line by itself (according to the Texinfo
  295.     % manual), we don't worry about eating any user text.
  296.     \comment
  297. % TeX puts in an \escapechar (i.e., `@') at the beginning of the help
  298. % message, so this ends up printing `@group can only ...'.
  299. \newhelp\groupinvalidhelp{%
  300. group can only be used in environments such as @example,^^J%
  301. where each line of input produces a line of output.}
  302. % @need space-in-mils
  303. % forces a page break if there is not space-in-mils remaining.
  304. \newdimen\mil  \mil=0.001in
  305. \def\need{\parsearg\needx}
  306. % Old definition--didn't work.
  307. %\def\needx #1{\par %
  308. %% This method tries to make TeX break the page naturally
  309. %% if the depth of the box does not fit.
  310. %{\baselineskip=0pt%
  311. %\vtop to #1\mil{\vfil}\kern -#1\mil\penalty 10000
  312. %\prevdepth=-1000pt
  313. \def\needx#1{%
  314.   % Go into vertical mode, so we don't make a big box in the middle of a
  315.   % paragraph.
  316.   \par
  317.   % Don't add any leading before our big empty box, but allow a page
  318.   % break, since the best break might be right here.
  319.   \allowbreak
  320.   \nointerlineskip
  321.   \vtop to #1\mil{\vfil}%
  322.   % TeX does not even consider page breaks if a penalty added to the
  323.   % main vertical list is 10000 or more.  But in order to see if the
  324.   % empty box we just added fits on the page, we must make it consider
  325.   % page breaks.  On the other hand, we don't want to actually break the
  326.   % page after the empty box.  So we use a penalty of 9999.
  327.   % There is an extremely small chance that TeX will actually break the
  328.   % page at this \penalty, if there are no other feasible breakpoints in
  329.   % sight.  (If the user is using lots of big @group commands, which
  330.   % almost-but-not-quite fill up a page, TeX will have a hard time doing
  331.   % good page breaking, for example.)  However, I could not construct an
  332.   % example where a page broke at this \penalty; if it happens in a real
  333.   % document, then we can reconsider our strategy.
  334.   \penalty9999
  335.   % Back up by the size of the box, whether we did a page break or not.
  336.   \kern -#1\mil
  337.   % Do not allow a page break right after this kern.
  338.   \nobreak
  339. % @br   forces paragraph break
  340. \let\br = \par
  341. % @dots{}  output some dots
  342. \def\dots{$\ldots$}
  343. % @page    forces the start of a new page
  344. \def\page{\par\vfill\supereject}
  345. % @exdent text....
  346. % outputs text on separate line in roman font, starting at standard page margin
  347. % This records the amount of indent in the innermost environment.
  348. % That's how much \exdent should take out.
  349. \newskip\exdentamount
  350. % This defn is used inside fill environments such as @defun.
  351. \def\exdent{\parsearg\exdentyyy}
  352. \def\exdentyyy #1{{\hfil\break\hbox{\kern -\exdentamount{\rm#1}}\hfil\break}}
  353. % This defn is used inside nofill environments such as @example.
  354. \def\nofillexdent{\parsearg\nofillexdentyyy}
  355. \def\nofillexdentyyy #1{{\advance \leftskip by -\exdentamount
  356. \leftline{\hskip\leftskip{\rm#1}}}}
  357. %\hbox{{\rm#1}}\hfil\break}}
  358. % @include file    insert text of that file as input.
  359. \def\include{\parsearg\includezzz}
  360. %Use \input\thisfile to avoid blank after \input, which may be an active
  361. %char (in which case the blank would become the \input argument).
  362. %The grouping keeps the value of \thisfile correct even when @include
  363. %is nested.
  364. \def\includezzz #1{\begingroup
  365. \def\thisfile{#1}\input\thisfile
  366. \endgroup}
  367. \def\thisfile{}
  368. % @center line   outputs that line, centered
  369. \def\center{\parsearg\centerzzz}
  370. \def\centerzzz #1{{\advance\hsize by -\leftskip
  371. \advance\hsize by -\rightskip
  372. \centerline{#1}}}
  373. % @sp n   outputs n lines of vertical space
  374. \def\sp{\parsearg\spxxx}
  375. \def\spxxx #1{\par \vskip #1\baselineskip}
  376. % @comment ...line which is ignored...
  377. % @c is the same as @comment
  378. % @ignore ... @end ignore  is another way to write a comment
  379. \def\comment{\catcode 64=\other \catcode 123=\other \catcode 125=\other%
  380. \parsearg \commentxxx}
  381. \def\commentxxx #1{\catcode 64=0 \catcode 123=1 \catcode 125=2 }
  382. \let\c=\comment
  383. % Prevent errors for section commands.
  384. % Used in @ignore and in failing conditionals.
  385. \def\ignoresections{%
  386. \let\chapter=\relax
  387. \let\unnumbered=\relax
  388. \let\top=\relax
  389. \let\unnumberedsec=\relax
  390. \let\unnumberedsection=\relax
  391. \let\unnumberedsubsec=\relax
  392. \let\unnumberedsubsection=\relax
  393. \let\unnumberedsubsubsec=\relax
  394. \let\unnumberedsubsubsection=\relax
  395. \let\section=\relax
  396. \let\subsec=\relax
  397. \let\subsubsec=\relax
  398. \let\subsection=\relax
  399. \let\subsubsection=\relax
  400. \let\appendix=\relax
  401. \let\appendixsec=\relax
  402. \let\appendixsection=\relax
  403. \let\appendixsubsec=\relax
  404. \let\appendixsubsection=\relax
  405. \let\appendixsubsubsec=\relax
  406. \let\appendixsubsubsection=\relax
  407. \let\contents=\relax
  408. \let\smallbook=\relax
  409. \let\titlepage=\relax
  410. % Used in nested conditionals, where we have to parse the Texinfo source
  411. % and so want to turn off most commands, in case they are used
  412. % incorrectly.  
  413. \def\ignoremorecommands{%
  414.   \let\defcv = \relax
  415.   \let\deffn = \relax
  416.   \let\deffnx = \relax
  417.   \let\defindex = \relax
  418.   \let\defivar = \relax
  419.   \let\defmac = \relax
  420.   \let\defmethod = \relax
  421.   \let\defop = \relax
  422.   \let\defopt = \relax
  423.   \let\defspec = \relax
  424.   \let\deftp = \relax
  425.   \let\deftypefn = \relax
  426.   \let\deftypefun = \relax
  427.   \let\deftypevar = \relax
  428.   \let\deftypevr = \relax
  429.   \let\defun = \relax
  430.   \let\defvar = \relax
  431.   \let\defvr = \relax
  432.   \let\ref = \relax
  433.   \let\xref = \relax
  434.   \let\printindex = \relax
  435.   \let\pxref = \relax
  436.   \let\settitle = \relax
  437.   \let\include = \relax
  438. % Ignore @ignore ... @end ignore.
  439. \def\ignore{\doignore{ignore}}
  440. % Also ignore @ifinfo, @menu, and @direntry text.
  441. \def\ifinfo{\doignore{ifinfo}}
  442. \def\menu{\doignore{menu}}
  443. \def\direntry{\doignore{direntry}}
  444. % Ignore text until a line `@end #1'.
  445. \def\doignore#1{\begingroup
  446.   % Don't complain about control sequences we have declared \outer.
  447.   \ignoresections
  448.   % Define a command to swallow text until we reach `@end #1'.
  449.   \long\def\doignoretext##1\end #1{\enddoignore}%
  450.   % Make sure that spaces turn into tokens that match what \doignoretext wants.
  451.   \catcode32 = 10
  452.   % And now expand that command.
  453.   \doignoretext
  454. % What we do to finish off ignored text.
  455. \def\enddoignore{\endgroup\ignorespaces}%
  456. \newif\ifwarnedobs\warnedobsfalse
  457. \def\obstexwarn{%
  458.   \ifwarnedobs\relax\else
  459.   % We need to warn folks that they may have trouble with TeX 3.0.
  460.   % This uses \immediate\write16 rather than \message to get newlines.
  461.     \immediate\write16{}
  462.     \immediate\write16{***WARNING*** for users of Unix TeX 3.0!}
  463.     \immediate\write16{This manual trips a bug in TeX version 3.0 (tex hangs).}
  464.     \immediate\write16{If you are running another version of TeX, relax.}
  465.     \immediate\write16{If you are running Unix TeX 3.0, kill this TeX process.}
  466.     \immediate\write16{  Then upgrade your TeX installation if you can.}
  467.     \immediate\write16{If you are stuck with version 3.0, run the}
  468.     \immediate\write16{  script ``tex3patch'' from the Texinfo distribution}
  469.     \immediate\write16{  to use a workaround.}
  470.     \immediate\write16{}
  471.     \warnedobstrue
  472.     \fi
  473. % **In TeX 3.0, setting text in \nullfont hangs tex.  For a
  474. % workaround (which requires the file ``dummy.tfm'' to be installed),
  475. % uncomment the following line:
  476. %%%%%\font\nullfont=dummy\let\obstexwarn=\relax
  477. % Ignore text, except that we keep track of conditional commands for
  478. % purposes of nesting, up to an `@end #1' command.
  479. \def\nestedignore#1{%
  480.   \obstexwarn
  481.   % We must actually expand the ignored text to look for the @end
  482.   % command, so that nested ignore constructs work.  Thus, we put the
  483.   % text into a \vbox and then do nothing with the result.  To minimize
  484.   % the change of memory overflow, we follow the approach outlined on
  485.   % page 401 of the TeXbook: make the current font be a dummy font.
  486.   \setbox0 = \vbox\bgroup
  487.     % Don't complain about control sequences we have declared \outer.
  488.     \ignoresections
  489.     %
  490.     % Define `@end #1' to end the box, which will in turn undefine the
  491.     % @end command again.
  492.     \expandafter\def\csname E#1\endcsname{\egroup\ignorespaces}%
  493.     %
  494.     % We are going to be parsing Texinfo commands.  Most cause no
  495.     % trouble when they are used incorrectly, but some commands do
  496.     % complicated argument parsing or otherwise get confused, so we
  497.     % undefine them.
  498.     %
  499.     % We can't do anything about stray @-signs, unfortunately;
  500.     % they'll produce `undefined control sequence' errors.
  501.     \ignoremorecommands
  502.     % 
  503.     % Set the current font to be \nullfont, a TeX primitive, and define
  504.     % all the font commands to also use \nullfont.  We don't use
  505.     % dummy.tfm, as suggested in the TeXbook, because not all sites
  506.     % might have that installed.  Therefore, math mode will still
  507.     % produce output, but that should be an extremely small amount of
  508.     % stuff compared to the main input.
  509.     %
  510.     \nullfont
  511.     \let\tenrm = \nullfont  \let\tenit = \nullfont  \let\tensl = \nullfont
  512.     \let\tenbf = \nullfont  \let\tentt = \nullfont  \let\smallcaps = \nullfont
  513.     \let\tensf = \nullfont
  514.     %
  515.     % Don't complain when characters are missing from the fonts.
  516.     \tracinglostchars = 0
  517.     %
  518.     % Don't bother to do space factor calculations.
  519.     \frenchspacing
  520.     %
  521.     % Don't report underfull hboxes.
  522.     \hbadness = 10000
  523.     %
  524.     % Do minimal line-breaking.
  525.     \pretolerance = 10000
  526.     %
  527.     % Do not execute instructions in @tex
  528.     \def\tex{\doignore{tex}}
  529. % @set VAR sets the variable VAR to an empty value.
  530. % @set VAR REST-OF-LINE sets VAR to the value REST-OF-LINE.
  531. % Since we want to separate VAR from REST-OF-LINE (which might be
  532. % empty), we can't just use \parsearg; we have to insert a space of our
  533. % own to delimit the rest of the line, and then take it out again if we
  534. % didn't need it.
  535. \def\set{\parsearg\setxxx}
  536. \def\setxxx#1{\setyyy#1 \endsetyyy}
  537. \def\setyyy#1 #2\endsetyyy{%
  538.   \def\temp{#2}%
  539.   \ifx\temp\empty \global\expandafter\let\csname SET#1\endcsname = \empty
  540.   \else \setzzz{#1}#2\endsetzzz % Remove the trailing space \setxxx inserted.
  541.   \fi
  542. \def\setzzz#1#2 \endsetzzz{\expandafter\xdef\csname SET#1\endcsname{#2}}
  543. % @clear VAR clears (i.e., unsets) the variable VAR.
  544. \def\clear{\parsearg\clearxxx}
  545. \def\clearxxx#1{\global\expandafter\let\csname SET#1\endcsname=\relax}
  546. % @value{foo} gets the text saved in variable foo.
  547. \def\value#1{\expandafter
  548.         \ifx\csname SET#1\endcsname\relax
  549.             {\{No value for ``#1''\}}
  550.         \else \csname SET#1\endcsname \fi}
  551. % @ifset VAR ... @end ifset reads the `...' iff VAR has been defined
  552. % with @set.
  553. \def\ifset{\parsearg\ifsetxxx}
  554. \def\ifsetxxx #1{%
  555.   \expandafter\ifx\csname SET#1\endcsname\relax
  556.     \expandafter\ifsetfail
  557.   \else
  558.     \expandafter\ifsetsucceed
  559.   \fi
  560. \def\ifsetsucceed{\conditionalsucceed{ifset}}
  561. \def\ifsetfail{\nestedignore{ifset}}
  562. \defineunmatchedend{ifset}
  563. % @ifclear VAR ... @end ifclear reads the `...' iff VAR has never been
  564. % defined with @set, or has been undefined with @clear.
  565. \def\ifclear{\parsearg\ifclearxxx}
  566. \def\ifclearxxx #1{%
  567.   \expandafter\ifx\csname SET#1\endcsname\relax
  568.     \expandafter\ifclearsucceed
  569.   \else
  570.     \expandafter\ifclearfail
  571.   \fi
  572. \def\ifclearsucceed{\conditionalsucceed{ifclear}}
  573. \def\ifclearfail{\nestedignore{ifclear}}
  574. \defineunmatchedend{ifclear}
  575. % @iftex always succeeds; we read the text following, through @end
  576. % iftex).  But `@end iftex' should be valid only after an @iftex.
  577. \def\iftex{\conditionalsucceed{iftex}}
  578. \defineunmatchedend{iftex}
  579. % We can't just want to start a group at @iftex (for example) and end it
  580. % at @end iftex, since then @set commands inside the conditional have no
  581. % effect (they'd get reverted at the end of the group).  So we must
  582. % define \Eiftex to redefine itself to be its previous value.  (We can't
  583. % just define it to fail again with an ``unmatched end'' error, since
  584. % the @ifset might be nested.)
  585. \def\conditionalsucceed#1{%
  586.   \edef\temp{%
  587.     % Remember the current value of \E#1.
  588.     \let\nece{prevE#1} = \nece{E#1}%
  589.     %
  590.     % At the `@end #1', redefine \E#1 to be its previous value.
  591.     \def\nece{E#1}{\let\nece{E#1} = \nece{prevE#1}}%
  592.   \temp
  593. % We need to expand lots of \csname's, but we don't want to expand the
  594. % control sequences after we've constructed them.
  595. \def\nece#1{\expandafter\noexpand\csname#1\endcsname}
  596. % @asis just yields its argument.  Used with @table, for example.
  597. \def\asis#1{#1}
  598. % @math means output in math mode.
  599. % We don't use $'s directly in the definition of \math because control
  600. % sequences like \math are expanded when the toc file is written.  Then,
  601. % we read the toc file back, the $'s will be normal characters (as they
  602. % should be, according to the definition of Texinfo).  So we must use a
  603. % control sequence to switch into and out of math mode.
  604. % This isn't quite enough for @math to work properly in indices, but it
  605. % seems unlikely it will ever be needed there.
  606. \let\implicitmath = $
  607. \def\math#1{\implicitmath #1\implicitmath}
  608. % @bullet and @minus need the same treatment as @math, just above.
  609. \def\bullet{\implicitmath\ptexbullet\implicitmath}
  610. \def\minus{\implicitmath-\implicitmath}
  611. \def\node{\ENVcheck\parsearg\nodezzz}
  612. \def\nodezzz#1{\nodexxx [#1,]}
  613. \def\nodexxx[#1,#2]{\gdef\lastnode{#1}}
  614. \let\nwnode=\node
  615. \let\lastnode=\relax
  616. \def\donoderef{\ifx\lastnode\relax\else
  617. \expandafter\expandafter\expandafter\setref{\lastnode}\fi
  618. \let\lastnode=\relax}
  619. \def\unnumbnoderef{\ifx\lastnode\relax\else
  620. \expandafter\expandafter\expandafter\unnumbsetref{\lastnode}\fi
  621. \let\lastnode=\relax}
  622. \def\appendixnoderef{\ifx\lastnode\relax\else
  623. \expandafter\expandafter\expandafter\appendixsetref{\lastnode}\fi
  624. \let\lastnode=\relax}
  625. \let\refill=\relax
  626. % @setfilename is done at the beginning of every texinfo file.
  627. % So open here the files we need to have open while reading the input.
  628. % This makes it possible to make a .fmt file for texinfo.
  629. \def\setfilename{%
  630.    \readauxfile
  631.    \opencontents
  632.    \openindices
  633.    \fixbackslash  % Turn off hack to swallow `\input texinfo'.
  634.    \global\let\setfilename=\comment % Ignore extra @setfilename cmds.
  635.    \comment % Ignore the actual filename.
  636. \outer\def\bye{\pagealignmacro\tracingstats=1\ptexend}
  637. \def\inforef #1{\inforefzzz #1,,,,**}
  638. \def\inforefzzz #1,#2,#3,#4**{See Info file \file{\ignorespaces #3{}},
  639.   node \samp{\ignorespaces#1{}}}
  640. \message{fonts,}
  641. % Font-change commands.
  642. % Texinfo supports the sans serif font style, which plain TeX does not.
  643. % So we set up a \sf analogous to plain's \rm, etc.
  644. \newfam\sffam
  645. \def\sf{\fam=\sffam \tensf}
  646. \let\li = \sf % Sometimes we call it \li, not \sf.
  647. %% Try out Computer Modern fonts at \magstephalf
  648. \let\mainmagstep=\magstephalf
  649. \ifx\bigger\relax
  650. \let\mainmagstep=\magstep1
  651. \font\textrm=cmr12
  652. \font\texttt=cmtt12
  653. \else
  654. \font\textrm=cmr10 scaled \mainmagstep
  655. \font\texttt=cmtt10 scaled \mainmagstep
  656. % Instead of cmb10, you many want to use cmbx10.
  657. % cmbx10 is a prettier font on its own, but cmb10
  658. % looks better when embedded in a line with cmr10.
  659. \font\textbf=cmb10 scaled \mainmagstep 
  660. \font\textit=cmti10 scaled \mainmagstep
  661. \font\textsl=cmsl10 scaled \mainmagstep
  662. \font\textsf=cmss10 scaled \mainmagstep
  663. \font\textsc=cmcsc10 scaled \mainmagstep
  664. \font\texti=cmmi10 scaled \mainmagstep
  665. \font\textsy=cmsy10 scaled \mainmagstep
  666. % A few fonts for @defun, etc.
  667. \font\defbf=cmbx10 scaled \magstep1 %was 1314
  668. \font\deftt=cmtt10 scaled \magstep1
  669. \def\df{\let\tentt=\deftt \let\tenbf = \defbf \bf}
  670. % Fonts for indices and small examples.
  671. % We actually use the slanted font rather than the italic, 
  672. % because texinfo normally uses the slanted fonts for that.
  673. % Do not make many font distinctions in general in the index, since they
  674. % aren't very useful.
  675. \font\ninett=cmtt9
  676. \font\indrm=cmr9
  677. \font\indit=cmsl9
  678. \let\indsl=\indit
  679. \let\indtt=\ninett
  680. \let\indsf=\indrm
  681. \let\indbf=\indrm
  682. \let\indsc=\indrm
  683. \font\indi=cmmi9
  684. \font\indsy=cmsy9
  685. % Fonts for headings
  686. \font\chaprm=cmbx12 scaled \magstep2
  687. \font\chapit=cmti12 scaled \magstep2
  688. \font\chapsl=cmsl12 scaled \magstep2
  689. \font\chaptt=cmtt12 scaled \magstep2
  690. \font\chapsf=cmss12 scaled \magstep2
  691. \let\chapbf=\chaprm
  692. \font\chapsc=cmcsc10 scaled\magstep3
  693. \font\chapi=cmmi12 scaled \magstep2
  694. \font\chapsy=cmsy10 scaled \magstep3
  695. \font\secrm=cmbx12 scaled \magstep1
  696. \font\secit=cmti12 scaled \magstep1
  697. \font\secsl=cmsl12 scaled \magstep1
  698. \font\sectt=cmtt12 scaled \magstep1
  699. \font\secsf=cmss12 scaled \magstep1
  700. \font\secbf=cmbx12 scaled \magstep1
  701. \font\secsc=cmcsc10 scaled\magstep2
  702. \font\seci=cmmi12 scaled \magstep1
  703. \font\secsy=cmsy10 scaled \magstep2
  704. % \font\ssecrm=cmbx10 scaled \magstep1    % This size an font looked bad.
  705. % \font\ssecit=cmti10 scaled \magstep1    % The letters were too crowded.
  706. % \font\ssecsl=cmsl10 scaled \magstep1
  707. % \font\ssectt=cmtt10 scaled \magstep1
  708. % \font\ssecsf=cmss10 scaled \magstep1
  709. %\font\ssecrm=cmb10 scaled 1315    % Note the use of cmb rather than cmbx.
  710. %\font\ssecit=cmti10 scaled 1315    % Also, the size is a little larger than
  711. %\font\ssecsl=cmsl10 scaled 1315    % being scaled magstep1.
  712. %\font\ssectt=cmtt10 scaled 1315
  713. %\font\ssecsf=cmss10 scaled 1315
  714. %\let\ssecbf=\ssecrm
  715. \font\ssecrm=cmbx12 scaled \magstephalf
  716. \font\ssecit=cmti12 scaled \magstephalf
  717. \font\ssecsl=cmsl12 scaled \magstephalf
  718. \font\ssectt=cmtt12 scaled \magstephalf
  719. \font\ssecsf=cmss12 scaled \magstephalf
  720. \font\ssecbf=cmbx12 scaled \magstephalf
  721. \font\ssecsc=cmcsc10 scaled \magstep1 
  722. \font\sseci=cmmi12 scaled \magstephalf
  723. \font\ssecsy=cmsy10 scaled \magstep1
  724. % The smallcaps and symbol fonts should actually be scaled \magstep1.5,
  725. % but that is not a standard magnification.
  726. % Fonts for title page:
  727. \font\titlerm = cmbx12 scaled \magstep3
  728. \let\authorrm = \secrm
  729. % In order for the font changes to affect most math symbols and letters,
  730. % we have to define the \textfont of the standard families.  Since
  731. % texinfo doesn't allow for producing subscripts and superscripts, we
  732. % don't bother to reset \scriptfont and \scriptscriptfont (which would
  733. % also require loading a lot more fonts).
  734. \def\resetmathfonts{%
  735.   \textfont0 = \tenrm \textfont1 = \teni \textfont2 = \tensy
  736.   \textfont\itfam = \tenit \textfont\slfam = \tensl \textfont\bffam = \tenbf
  737.   \textfont\ttfam = \tentt \textfont\sffam = \tensf
  738. % The font-changing commands redefine the meanings of \tenSTYLE, instead
  739. % of just \STYLE.  We do this so that font changes will continue to work
  740. % in math mode, where it is the current \fam that is relevant in most
  741. % cases, not the current.  Plain TeX does, for example,
  742. % \def\bf{\fam=\bffam \tenbf}  By redefining \tenbf, we obviate the need
  743. % to redefine \bf itself.  
  744. \def\textfonts{%
  745.   \let\tenrm=\textrm \let\tenit=\textit \let\tensl=\textsl
  746.   \let\tenbf=\textbf \let\tentt=\texttt \let\smallcaps=\textsc
  747.   \let\tensf=\textsf \let\teni=\texti \let\tensy=\textsy
  748.   \resetmathfonts}
  749. \def\chapfonts{%
  750.   \let\tenrm=\chaprm \let\tenit=\chapit \let\tensl=\chapsl 
  751.   \let\tenbf=\chapbf \let\tentt=\chaptt \let\smallcaps=\chapsc
  752.   \let\tensf=\chapsf \let\teni=\chapi \let\tensy=\chapsy
  753.   \resetmathfonts}
  754. \def\secfonts{%
  755.   \let\tenrm=\secrm \let\tenit=\secit \let\tensl=\secsl
  756.   \let\tenbf=\secbf \let\tentt=\sectt \let\smallcaps=\secsc
  757.   \let\tensf=\secsf \let\teni=\seci \let\tensy=\secsy
  758.   \resetmathfonts}
  759. \def\subsecfonts{%
  760.   \let\tenrm=\ssecrm \let\tenit=\ssecit \let\tensl=\ssecsl
  761.   \let\tenbf=\ssecbf \let\tentt=\ssectt \let\smallcaps=\ssecsc
  762.   \let\tensf=\ssecsf \let\teni=\sseci \let\tensy=\ssecsy
  763.   \resetmathfonts}
  764. \def\indexfonts{%
  765.   \let\tenrm=\indrm \let\tenit=\indit \let\tensl=\indsl
  766.   \let\tenbf=\indbf \let\tentt=\indtt \let\smallcaps=\indsc
  767.   \let\tensf=\indsf \let\teni=\indi \let\tensy=\indsy
  768.   \resetmathfonts}
  769. % Set up the default fonts, so we can use them for creating boxes.
  770. \textfonts
  771. % Count depth in font-changes, for error checks
  772. \newcount\fontdepth \fontdepth=0
  773. % Fonts for short table of contents.
  774. \font\shortcontrm=cmr12
  775. \font\shortcontbf=cmbx12
  776. \font\shortcontsl=cmsl12
  777. %% Add scribe-like font environments, plus @l for inline lisp (usually sans
  778. %% serif) and @ii for TeX italic
  779. % \smartitalic{ARG} outputs arg in italics, followed by an italic correction
  780. % unless the following character is such as not to need one.
  781. \def\smartitalicx{\ifx\next,\else\ifx\next-\else\ifx\next.\else\/\fi\fi\fi}
  782. \def\smartitalic#1{{\sl #1}\futurelet\next\smartitalicx}
  783. \let\i=\smartitalic
  784. \let\var=\smartitalic
  785. \let\dfn=\smartitalic
  786. \let\emph=\smartitalic
  787. \let\cite=\smartitalic
  788. \def\b#1{{\bf #1}}
  789. \let\strong=\b
  790. % We can't just use \exhyphenpenalty, because that only has effect at
  791. % the end of a paragraph.  Restore normal hyphenation at the end of the
  792. % group within which \nohyphenation is presumably called.
  793. \def\nohyphenation{\hyphenchar\font = -1  \aftergroup\restorehyphenation}
  794. \def\restorehyphenation{\hyphenchar\font = `- }
  795. \def\t#1{%
  796.   {\tt \nohyphenation \rawbackslash \frenchspacing #1}%
  797.   \null
  798. \let\ttfont = \t
  799. %\def\samp #1{`{\tt \rawbackslash \frenchspacing #1}'\null}
  800. \def\samp #1{`\tclose{#1}'\null}
  801. \def\key #1{{\tt \nohyphenation \uppercase{#1}}\null}
  802. \def\ctrl #1{{\tt \rawbackslash \hat}#1}
  803. \let\file=\samp
  804. % @code is a modification of @t,
  805. % which makes spaces the same size as normal in the surrounding text.
  806. \def\tclose#1{%
  807.     % Change normal interword space to be same as for the current font.
  808.     \spaceskip = \fontdimen2\font
  809.     %
  810.     % Switch to typewriter.
  811.     \tt
  812.     %
  813.     % But `\ ' produces the large typewriter interword space.
  814.     \def\ {{\spaceskip = 0pt{} }}%
  815.     %
  816.     % Turn off hyphenation.
  817.     \nohyphenation
  818.     % 
  819.     \rawbackslash
  820.     \frenchspacing
  821.     #1%
  822.   \null
  823. \let\code=\tclose
  824. %\let\exp=\tclose  %Was temporary
  825. % @kbd is like @code, except that if the argument is just one @key command, 
  826. % then @kbd has no effect.
  827. \def\xkey{\key}
  828. \def\kbdfoo#1#2#3\par{\def\one{#1}\def\three{#3}\def\threex{??}%
  829. \ifx\one\xkey\ifx\threex\three \key{#2}%
  830. \else\tclose{\look}\fi
  831. \else\tclose{\look}\fi}
  832. % Typeset a dimension, e.g., `in' or `pt'.  The only reason for the
  833. % argument is to make the input look right: @dmn{pt} instead of
  834. % @dmn{}pt.
  835. \def\dmn#1{\thinspace #1}
  836. \def\kbd#1{\def\look{#1}\expandafter\kbdfoo\look??\par}
  837. \def\l#1{{\li #1}\null}        % 
  838. \def\r#1{{\rm #1}}        % roman font
  839. % Use of \lowercase was suggested.
  840. \def\sc#1{{\smallcaps#1}}    % smallcaps font
  841. \def\ii#1{{\it #1}}        % italic font
  842. \message{page headings,}
  843. \newskip\titlepagetopglue \titlepagetopglue = 1.5in
  844. \newskip\titlepagebottomglue \titlepagebottomglue = 2pc
  845. % First the title page.  Must do @settitle before @titlepage.
  846. \def\titlefont#1{{\titlerm #1}}
  847. \newif\ifseenauthor
  848. \newif\iffinishedtitlepage
  849. \def\shorttitlepage{\parsearg\shorttitlepagezzz}
  850. \def\shorttitlepagezzz #1{\begingroup\hbox{}\vskip 1.5in \chaprm \centerline{#1}%
  851.     \endgroup\page\hbox{}\page}
  852. \def\titlepage{\begingroup \parindent=0pt \textfonts
  853.    \let\subtitlerm=\tenrm
  854. % I deinstalled the following change because \cmr12 is undefined.
  855. % This change was not in the ChangeLog anyway.  --rms.
  856. %   \let\subtitlerm=\cmr12
  857.    \def\subtitlefont{\subtitlerm \normalbaselineskip = 13pt \normalbaselines}%
  858.    \def\authorfont{\authorrm \normalbaselineskip = 16pt \normalbaselines}%
  859.    % Leave some space at the very top of the page.
  860.    \vglue\titlepagetopglue
  861.    % Now you can print the title using @title.
  862.    \def\title{\parsearg\titlezzz}%
  863.    \def\titlezzz##1{\leftline{\titlefont{##1}}
  864.             % print a rule at the page bottom also.
  865.             \finishedtitlepagefalse
  866.             \vskip4pt \hrule height 4pt \vskip4pt}%
  867.    % No rule at page bottom unless we print one at the top with @title.
  868.    \finishedtitlepagetrue
  869.    % Now you can put text using @subtitle.
  870.    \def\subtitle{\parsearg\subtitlezzz}%
  871.    \def\subtitlezzz##1{{\subtitlefont \rightline{##1}}}%
  872.    % @author should come last, but may come many times.
  873.    \def\author{\parsearg\authorzzz}%
  874.    \def\authorzzz##1{\ifseenauthor\else\vskip 0pt plus 1filll\seenauthortrue\fi
  875.       {\authorfont \leftline{##1}}}%
  876.    %  
  877.    % Most title ``pages'' are actually two pages long, with space
  878.    % at the top of the second.  We don't want the ragged left on the second.
  879.    \let\oldpage = \page
  880.    \def\page{%
  881.       \iffinishedtitlepage\else
  882.      \finishtitlepage
  883.       \fi
  884.       \oldpage
  885.       \let\page = \oldpage
  886.       \hbox{}}%
  887. %   \def\page{\oldpage \hbox{}}
  888. \def\Etitlepage{%
  889.    \iffinishedtitlepage\else
  890.       \finishtitlepage
  891.    \fi
  892.    % It is important to do the page break before ending the group,
  893.    % because the headline and footline are only empty inside the group.
  894.    % If we use the new definition of \page, we always get a blank page
  895.    % after the title page, which we certainly don't want.
  896.    \oldpage
  897.    \endgroup
  898.    \HEADINGSon
  899. \def\finishtitlepage{%
  900.    \vskip4pt \hrule height 2pt
  901.    \vskip\titlepagebottomglue
  902.    \finishedtitlepagetrue
  903. %%% Set up page headings and footings.
  904. \let\thispage=\folio
  905. \newtoks \evenheadline    % Token sequence for heading line of even pages
  906. \newtoks \oddheadline     % Token sequence for heading line of odd pages
  907. \newtoks \evenfootline    % Token sequence for footing line of even pages
  908. \newtoks \oddfootline     % Token sequence for footing line of odd pages
  909. % Now make Tex use those variables
  910. \headline={{\textfonts\rm \ifodd\pageno \the\oddheadline
  911.                             \else \the\evenheadline \fi}}
  912. \footline={{\textfonts\rm \ifodd\pageno \the\oddfootline
  913.                             \else \the\evenfootline \fi}\HEADINGShook}
  914. \let\HEADINGShook=\relax
  915. % Commands to set those variables.
  916. % For example, this is what  @headings on  does
  917. % @evenheading @thistitle|@thispage|@thischapter
  918. % @oddheading @thischapter|@thispage|@thistitle
  919. % @evenfooting @thisfile||
  920. % @oddfooting ||@thisfile
  921. \def\evenheading{\parsearg\evenheadingxxx}
  922. \def\oddheading{\parsearg\oddheadingxxx}
  923. \def\everyheading{\parsearg\everyheadingxxx}
  924. \def\evenfooting{\parsearg\evenfootingxxx}
  925. \def\oddfooting{\parsearg\oddfootingxxx}
  926. \def\everyfooting{\parsearg\everyfootingxxx}
  927. {\catcode`\@=0 %
  928. \gdef\evenheadingxxx #1{\evenheadingyyy #1@|@|@|@|\finish}
  929. \gdef\evenheadingyyy #1@|#2@|#3@|#4\finish{%
  930. \global\evenheadline={\rlap{\centerline{#2}}\line{#1\hfil#3}}}
  931. \gdef\oddheadingxxx #1{\oddheadingyyy #1@|@|@|@|\finish}
  932. \gdef\oddheadingyyy #1@|#2@|#3@|#4\finish{%
  933. \global\oddheadline={\rlap{\centerline{#2}}\line{#1\hfil#3}}}
  934. \gdef\everyheadingxxx #1{\everyheadingyyy #1@|@|@|@|\finish}
  935. \gdef\everyheadingyyy #1@|#2@|#3@|#4\finish{%
  936. \global\evenheadline={\rlap{\centerline{#2}}\line{#1\hfil#3}}
  937. \global\oddheadline={\rlap{\centerline{#2}}\line{#1\hfil#3}}}
  938. \gdef\evenfootingxxx #1{\evenfootingyyy #1@|@|@|@|\finish}
  939. \gdef\evenfootingyyy #1@|#2@|#3@|#4\finish{%
  940. \global\evenfootline={\rlap{\centerline{#2}}\line{#1\hfil#3}}}
  941. \gdef\oddfootingxxx #1{\oddfootingyyy #1@|@|@|@|\finish}
  942. \gdef\oddfootingyyy #1@|#2@|#3@|#4\finish{%
  943. \global\oddfootline={\rlap{\centerline{#2}}\line{#1\hfil#3}}}
  944. \gdef\everyfootingxxx #1{\everyfootingyyy #1@|@|@|@|\finish}
  945. \gdef\everyfootingyyy #1@|#2@|#3@|#4\finish{%
  946. \global\evenfootline={\rlap{\centerline{#2}}\line{#1\hfil#3}}
  947. \global\oddfootline={\rlap{\centerline{#2}}\line{#1\hfil#3}}}
  948. }% unbind the catcode of @.
  949. % @headings double    turns headings on for double-sided printing.
  950. % @headings single    turns headings on for single-sided printing.
  951. % @headings off        turns them off.
  952. % @headings on        same as @headings double, retained for compatibility.
  953. % @headings after    turns on double-sided headings after this page.
  954. % @headings doubleafter    turns on double-sided headings after this page.
  955. % @headings singleafter turns on single-sided headings after this page.
  956. % By default, they are off.
  957. \def\headings #1 {\csname HEADINGS#1\endcsname}
  958. \def\HEADINGSoff{
  959. \global\evenheadline={\hfil} \global\evenfootline={\hfil}
  960. \global\oddheadline={\hfil} \global\oddfootline={\hfil}}
  961. \HEADINGSoff
  962. % When we turn headings on, set the page number to 1.
  963. % For double-sided printing, put current file name in lower left corner,
  964. % chapter name on inside top of right hand pages, document
  965. % title on inside top of left hand pages, and page numbers on outside top
  966. % edge of all pages.
  967. \def\HEADINGSdouble{
  968. %\pagealignmacro
  969. \global\pageno=1
  970. \global\evenfootline={\hfil}
  971. \global\oddfootline={\hfil}
  972. \global\evenheadline={\line{\folio\hfil\thistitle}}
  973. \global\oddheadline={\line{\thischapter\hfil\folio}}
  974. % For single-sided printing, chapter title goes across top left of page,
  975. % page number on top right.
  976. \def\HEADINGSsingle{
  977. %\pagealignmacro
  978. \global\pageno=1
  979. \global\evenfootline={\hfil}
  980. \global\oddfootline={\hfil}
  981. \global\evenheadline={\line{\thischapter\hfil\folio}}
  982. \global\oddheadline={\line{\thischapter\hfil\folio}}
  983. \def\HEADINGSon{\HEADINGSdouble}
  984. \def\HEADINGSafter{\let\HEADINGShook=\HEADINGSdoublex}
  985. \let\HEADINGSdoubleafter=\HEADINGSafter
  986. \def\HEADINGSdoublex{%
  987. \global\evenfootline={\hfil}
  988. \global\oddfootline={\hfil}
  989. \global\evenheadline={\line{\folio\hfil\thistitle}}
  990. \global\oddheadline={\line{\thischapter\hfil\folio}}
  991. \def\HEADINGSsingleafter{\let\HEADINGShook=\HEADINGSsinglex}
  992. \def\HEADINGSsinglex{%
  993. \global\evenfootline={\hfil}
  994. \global\oddfootline={\hfil}
  995. \global\evenheadline={\line{\thischapter\hfil\folio}}
  996. \global\oddheadline={\line{\thischapter\hfil\folio}}
  997. % Subroutines used in generating headings
  998. % Produces Day Month Year style of output.
  999. \def\today{\number\day\space
  1000. \ifcase\month\or
  1001. January\or February\or March\or April\or May\or June\or
  1002. July\or August\or September\or October\or November\or December\fi
  1003. \space\number\year}
  1004. % Use this if you want the Month Day, Year style of output.
  1005. %\def\today{\ifcase\month\or
  1006. %January\or February\or March\or April\or May\or June\or
  1007. %July\or August\or September\or October\or November\or December\fi
  1008. %\space\number\day, \number\year}
  1009. % @settitle line...  specifies the title of the document, for headings
  1010. % It generates no output of its own
  1011. \def\thistitle{No Title}
  1012. \def\settitle{\parsearg\settitlezzz}
  1013. \def\settitlezzz #1{\gdef\thistitle{#1}}
  1014. \message{tables,}
  1015. % @tabs -- simple alignment
  1016. % These don't work.  For one thing, \+ is defined as outer.
  1017. % So these macros cannot even be defined.
  1018. %\def\tabs{\parsearg\tabszzz}
  1019. %\def\tabszzz #1{\settabs\+#1\cr}
  1020. %\def\tabline{\parsearg\tablinezzz}
  1021. %\def\tablinezzz #1{\+#1\cr}
  1022. %\def\&{&}
  1023. % Tables -- @table, @ftable, @vtable, @item(x), @kitem(x), @xitem(x).
  1024. % default indentation of table text
  1025. \newdimen\tableindent \tableindent=.8in
  1026. % default indentation of @itemize and @enumerate text
  1027. \newdimen\itemindent  \itemindent=.3in
  1028. % margin between end of table item and start of table text.
  1029. \newdimen\itemmargin  \itemmargin=.1in
  1030. % used internally for \itemindent minus \itemmargin
  1031. \newdimen\itemmax
  1032. % Note @table, @vtable, and @vtable define @item, @itemx, etc., with
  1033. % these defs.
  1034. % They also define \itemindex
  1035. % to index the item name in whatever manner is desired (perhaps none).
  1036. \def\internalBitem{\smallbreak \parsearg\itemzzz}
  1037. \def\internalBitemx{\par \parsearg\itemzzz}
  1038. \def\internalBxitem "#1"{\def\xitemsubtopix{#1} \smallbreak \parsearg\xitemzzz}
  1039. \def\internalBxitemx "#1"{\def\xitemsubtopix{#1} \par \parsearg\xitemzzz}
  1040. \def\internalBkitem{\smallbreak \parsearg\kitemzzz}
  1041. \def\internalBkitemx{\par \parsearg\kitemzzz}
  1042. \def\kitemzzz #1{\dosubind {kw}{\code{#1}}{for {\bf \lastfunction}}%
  1043.                  \itemzzz {#1}}
  1044. \def\xitemzzz #1{\dosubind {kw}{\code{#1}}{for {\bf \xitemsubtopic}}%
  1045.                  \itemzzz {#1}}
  1046. \def\itemzzz #1{\begingroup %
  1047.   \advance\hsize by -\rightskip
  1048.   \advance\hsize by -\tableindent
  1049.   \setbox0=\hbox{\itemfont{#1}}%
  1050.   \itemindex{#1}%
  1051.   \nobreak % This prevents a break before @itemx.
  1052.   % Be sure we are not still in the middle of a paragraph.
  1053.   \parskip=0in
  1054.   \par
  1055.   % If the item text does not fit in the space we have, put it on a line
  1056.   % by itself, and do not allow a page break either before or after that
  1057.   % line.  We do not start a paragraph here because then if the next
  1058.   % command is, e.g., @kindex, the whatsit would get put into the
  1059.   % horizontal list on a line by itself, resulting in extra blank space.
  1060.   \ifdim \wd0>\itemmax
  1061.     \setbox0=\hbox{\hskip \leftskip \hskip -\tableindent \unhbox0}\box0
  1062.     \nobreak
  1063.   \else
  1064.     % The item text fits into the space.  Start a paragraph, so that the
  1065.     % following text (if any) will end up on the same line.  Since that
  1066.     % text will be indented by \tableindent, we make the item text be in
  1067.     % a zero-width box.
  1068.     \noindent
  1069.     \rlap{\hskip -\tableindent\box0}%
  1070.   \fi
  1071.   \endgroup
  1072. \def\item{\errmessage{@item while not in a table}}
  1073. \def\itemx{\errmessage{@itemx while not in a table}}
  1074. \def\kitem{\errmessage{@kitem while not in a table}}
  1075. \def\kitemx{\errmessage{@kitemx while not in a table}}
  1076. \def\xitem{\errmessage{@xitem while not in a table}}
  1077. \def\xitemx{\errmessage{@xitemx while not in a table}}
  1078. %% Contains a kludge to get @end[description] to work
  1079. \def\description{\tablez{\dontindex}{1}{}{}{}{}}
  1080. \def\table{\begingroup\inENV\obeylines\obeyspaces\tablex}
  1081. {\obeylines\obeyspaces%
  1082. \gdef\tablex #1^^M{%
  1083. \tabley\dontindex#1        \endtabley}}
  1084. \def\ftable{\begingroup\inENV\obeylines\obeyspaces\ftablex}
  1085. {\obeylines\obeyspaces%
  1086. \gdef\ftablex #1^^M{%
  1087. \tabley\fnitemindex#1        \endtabley
  1088. \def\Eftable{\endgraf\endgroup\afterenvbreak}%
  1089. \let\Etable=\relax}}
  1090. \def\vtable{\begingroup\inENV\obeylines\obeyspaces\vtablex}
  1091. {\obeylines\obeyspaces%
  1092. \gdef\vtablex #1^^M{%
  1093. \tabley\vritemindex#1        \endtabley
  1094. \def\Evtable{\endgraf\endgroup\afterenvbreak}%
  1095. \let\Etable=\relax}}
  1096. \def\dontindex #1{}
  1097. \def\fnitemindex #1{\doind {fn}{\code{#1}}}%
  1098. \def\vritemindex #1{\doind {vr}{\code{#1}}}%
  1099. {\obeyspaces %
  1100. \gdef\tabley#1#2 #3 #4 #5 #6 #7\endtabley{\endgroup%
  1101. \tablez{#1}{#2}{#3}{#4}{#5}{#6}}}
  1102. \def\tablez #1#2#3#4#5#6{%
  1103. \aboveenvbreak %
  1104. \begingroup %
  1105. \def\Edescription{\Etable}% Neccessary kludge.
  1106. \let\itemindex=#1%
  1107. \ifnum 0#3>0 \advance \leftskip by #3\mil \fi %
  1108. \ifnum 0#4>0 \tableindent=#4\mil \fi %
  1109. \ifnum 0#5>0 \advance \rightskip by #5\mil \fi %
  1110. \def\itemfont{#2}%
  1111. \itemmax=\tableindent %
  1112. \advance \itemmax by -\itemmargin %
  1113. \advance \leftskip by \tableindent %
  1114. \exdentamount=\tableindent
  1115. \parindent = 0pt
  1116. \parskip = \smallskipamount
  1117. \ifdim \parskip=0pt \parskip=2pt \fi%
  1118. \def\Etable{\endgraf\endgroup\afterenvbreak}%
  1119. \let\item = \internalBitem %
  1120. \let\itemx = \internalBitemx %
  1121. \let\kitem = \internalBkitem %
  1122. \let\kitemx = \internalBkitemx %
  1123. \let\xitem = \internalBxitem %
  1124. \let\xitemx = \internalBxitemx %
  1125. % This is the counter used by @enumerate, which is really @itemize
  1126. \newcount \itemno
  1127. \def\itemize{\parsearg\itemizezzz}
  1128. \def\itemizezzz #1{%
  1129.   \begingroup % ended by the @end itemsize
  1130.   \itemizey {#1}{\Eitemize}
  1131. \def\itemizey #1#2{%
  1132. \aboveenvbreak %
  1133. \itemmax=\itemindent %
  1134. \advance \itemmax by -\itemmargin %
  1135. \advance \leftskip by \itemindent %
  1136. \exdentamount=\itemindent
  1137. \parindent = 0pt %
  1138. \parskip = \smallskipamount %
  1139. \ifdim \parskip=0pt \parskip=2pt \fi%
  1140. \def#2{\endgraf\endgroup\afterenvbreak}%
  1141. \def\itemcontents{#1}%
  1142. \let\item=\itemizeitem}
  1143. % Set sfcode to normal for the chars that usually have another value.
  1144. % These are `.?!:;,'
  1145. \def\frenchspacing{\sfcode46=1000 \sfcode63=1000 \sfcode33=1000
  1146.   \sfcode58=1000 \sfcode59=1000 \sfcode44=1000 }
  1147. % \splitoff TOKENS\endmark defines \first to be the first token in
  1148. % TOKENS, and \rest to be the remainder.
  1149. \def\splitoff#1#2\endmark{\def\first{#1}\def\rest{#2}}%
  1150. % Allow an optional argument of an uppercase letter, lowercase letter,
  1151. % or number, to specify the first label in the enumerated list.  No
  1152. % argument is the same as `1'.
  1153. \def\enumerate{\parsearg\enumeratezzz}
  1154. \def\enumeratezzz #1{\enumeratey #1  \endenumeratey}
  1155. \def\enumeratey #1 #2\endenumeratey{%
  1156.   \begingroup % ended by the @end enumerate
  1157.   % If we were given no argument, pretend we were given `1'.
  1158.   \def\thearg{#1}%
  1159.   \ifx\thearg\empty \def\thearg{1}\fi
  1160.   % Detect if the argument is a single token.  If so, it might be a
  1161.   % letter.  Otherwise, the only valid thing it can be is a number.
  1162.   % (We will always have one token, because of the test we just made.
  1163.   % This is a good thing, since \splitoff doesn't work given nothing at
  1164.   % all -- the first parameter is undelimited.)
  1165.   \expandafter\splitoff\thearg\endmark
  1166.   \ifx\rest\empty
  1167.     % Only one token in the argument.  It could still be anything.
  1168.     % A ``lowercase letter'' is one whose \lccode is nonzero.
  1169.     % An ``uppercase letter'' is one whose \lccode is both nonzero, and
  1170.     %   not equal to itself.
  1171.     % Otherwise, we assume it's a number.
  1172.     % 
  1173.     % We need the \relax at the end of the \ifnum lines to stop TeX from
  1174.     % continuing to look for a <number>.
  1175.     % 
  1176.     \ifnum\lccode\expandafter`\thearg=0\relax 
  1177.       \numericenumerate % a number (we hope)
  1178.     \else
  1179.       % It's a letter.
  1180.       \ifnum\lccode\expandafter`\thearg=\expandafter`\thearg\relax
  1181.         \lowercaseenumerate % lowercase letter
  1182.       \else
  1183.         \uppercaseenumerate % uppercase letter
  1184.       \fi
  1185.     \fi
  1186.   \else
  1187.     % Multiple tokens in the argument.  We hope it's a number.
  1188.     \numericenumerate
  1189.   \fi
  1190. % An @enumerate whose labels are integers.  The starting integer is
  1191. % given in \thearg.
  1192. \def\numericenumerate{%
  1193.   \itemno = \thearg
  1194.   \startenumeration{\the\itemno}%
  1195. % The starting (lowercase) letter is in \thearg.
  1196. \def\lowercaseenumerate{%
  1197.   \itemno = \expandafter`\thearg
  1198.   \startenumeration{%
  1199.     % Be sure we're not beyond the end of the alphabet.
  1200.     \ifnum\itemno=0
  1201.       \errmessage{No more lowercase letters in @enumerate; get a bigger
  1202.                   alphabet}%
  1203.     \fi
  1204.     \char\lccode\itemno
  1205. % The starting (uppercase) letter is in \thearg.
  1206. \def\uppercaseenumerate{%
  1207.   \itemno = \expandafter`\thearg
  1208.   \startenumeration{%
  1209.     % Be sure we're not beyond the end of the alphabet.
  1210.     \ifnum\itemno=0
  1211.       \errmessage{No more uppercase letters in @enumerate; get a bigger
  1212.                   alphabet}
  1213.     \fi
  1214.     \char\uccode\itemno
  1215. % Call itemizey, adding a period to the first argument and supplying the
  1216. % common last two arguments.  Also subtract one from the initial value in
  1217. % \itemno, since @item increments \itemno.
  1218. \def\startenumeration#1{%
  1219.   \advance\itemno by -1
  1220.   \itemizey{#1.}\Eenumerate\flushcr
  1221. % @alphaenumerate and @capsenumerate are abbreviations for giving an arg
  1222. % to @enumerate.
  1223. \def\alphaenumerate{\enumerate{a}}
  1224. \def\capsenumerate{\enumerate{A}}
  1225. \def\Ealphaenumerate{\Eenumerate}
  1226. \def\Ecapsenumerate{\Eenumerate}
  1227. % Definition of @item while inside @itemize.
  1228. \def\itemizeitem{%
  1229. \advance\itemno by 1
  1230. {\let\par=\endgraf \smallbreak}%
  1231. \ifhmode \errmessage{\in hmode at itemizeitem}\fi
  1232. {\parskip=0in \hskip 0pt
  1233. \hbox to 0pt{\hss \itemcontents\hskip \itemmargin}%
  1234. \vadjust{\penalty 1200}}%
  1235. \flushcr}
  1236. \message{indexing,}
  1237. % Index generation facilities
  1238. % Define \newwrite to be identical to plain tex's \newwrite
  1239. % except not \outer, so it can be used within \newindex.
  1240. {\catcode`\@=11
  1241. \gdef\newwrite{\alloc@7\write\chardef\sixt@@n}}
  1242. % \newindex {foo} defines an index named foo.
  1243. % It automatically defines \fooindex such that
  1244. % \fooindex ...rest of line... puts an entry in the index foo.
  1245. % It also defines \fooindfile to be the number of the output channel for
  1246. % the file that    accumulates this index.  The file's extension is foo.
  1247. % The name of an index should be no more than 2 characters long
  1248. % for the sake of vms.
  1249. \def\newindex #1{
  1250. \expandafter\newwrite \csname#1indfile\endcsname% Define number for output file
  1251. \openout \csname#1indfile\endcsname \jobname.#1    % Open the file
  1252. \expandafter\xdef\csname#1index\endcsname{%    % Define \xxxindex
  1253. \noexpand\doindex {#1}}
  1254. % @defindex foo  ==  \newindex{foo}
  1255. \def\defindex{\parsearg\newindex}
  1256. % Define @defcodeindex, like @defindex except put all entries in @code.
  1257. \def\newcodeindex #1{
  1258. \expandafter\newwrite \csname#1indfile\endcsname% Define number for output file
  1259. \openout \csname#1indfile\endcsname \jobname.#1    % Open the file
  1260. \expandafter\xdef\csname#1index\endcsname{%    % Define \xxxindex
  1261. \noexpand\docodeindex {#1}}
  1262. \def\defcodeindex{\parsearg\newcodeindex}
  1263. % @synindex foo bar    makes index foo feed into index bar.
  1264. % Do this instead of @defindex foo if you don't want it as a separate index.
  1265. \def\synindex #1 #2 {%
  1266. \expandafter\let\expandafter\synindexfoo\expandafter=\csname#2indfile\endcsname
  1267. \expandafter\let\csname#1indfile\endcsname=\synindexfoo
  1268. \expandafter\xdef\csname#1index\endcsname{%    % Define \xxxindex
  1269. \noexpand\doindex {#2}}%
  1270. % @syncodeindex foo bar   similar, but put all entries made for index foo
  1271. % inside @code.
  1272. \def\syncodeindex #1 #2 {%
  1273. \expandafter\let\expandafter\synindexfoo\expandafter=\csname#2indfile\endcsname
  1274. \expandafter\let\csname#1indfile\endcsname=\synindexfoo
  1275. \expandafter\xdef\csname#1index\endcsname{%    % Define \xxxindex
  1276. \noexpand\docodeindex {#2}}%
  1277. % Define \doindex, the driver for all \fooindex macros.
  1278. % Argument #1 is generated by the calling \fooindex macro,
  1279. %  and it is "foo", the name of the index.
  1280. % \doindex just uses \parsearg; it calls \doind for the actual work.
  1281. % This is because \doind is more useful to call from other macros.
  1282. % There is also \dosubind {index}{topic}{subtopic}
  1283. % which makes an entry in a two-level index such as the operation index.
  1284. \def\doindex#1{\edef\indexname{#1}\parsearg\singleindexer}
  1285. \def\singleindexer #1{\doind{\indexname}{#1}}
  1286. % like the previous two, but they put @code around the argument.
  1287. \def\docodeindex#1{\edef\indexname{#1}\parsearg\singlecodeindexer}
  1288. \def\singlecodeindexer #1{\doind{\indexname}{\code{#1}}}
  1289. \def\indexdummies{%
  1290. \def\_{{\realbackslash _}}%
  1291. \def\w{\realbackslash w }%
  1292. \def\bf{\realbackslash bf }%
  1293. \def\rm{\realbackslash rm }%
  1294. \def\sl{\realbackslash sl }%
  1295. \def\sf{\realbackslash sf}%
  1296. \def\tt{\realbackslash tt}%
  1297. \def\gtr{\realbackslash gtr}%
  1298. \def\less{\realbackslash less}%
  1299. \def\hat{\realbackslash hat}%
  1300. \def\char{\realbackslash char}%
  1301. \def\TeX{\realbackslash TeX}%
  1302. \def\dots{\realbackslash dots }%
  1303. \def\copyright{\realbackslash copyright }%
  1304. \def\tclose##1{\realbackslash tclose {##1}}%
  1305. \def\code##1{\realbackslash code {##1}}%
  1306. \def\samp##1{\realbackslash samp {##1}}%
  1307. \def\t##1{\realbackslash r {##1}}%
  1308. \def\r##1{\realbackslash r {##1}}%
  1309. \def\i##1{\realbackslash i {##1}}%
  1310. \def\b##1{\realbackslash b {##1}}%
  1311. \def\cite##1{\realbackslash cite {##1}}%
  1312. \def\key##1{\realbackslash key {##1}}%
  1313. \def\file##1{\realbackslash file {##1}}%
  1314. \def\var##1{\realbackslash var {##1}}%
  1315. \def\kbd##1{\realbackslash kbd {##1}}%
  1316. \def\dfn##1{\realbackslash dfn {##1}}%
  1317. \def\emph##1{\realbackslash emph {##1}}%
  1318. % \indexnofonts no-ops all font-change commands.
  1319. % This is used when outputting the strings to sort the index by.
  1320. \def\indexdummyfont#1{#1}
  1321. \def\indexdummytex{TeX}
  1322. \def\indexdummydots{...}
  1323. \def\indexnofonts{%
  1324. \let\w=\indexdummyfont
  1325. \let\t=\indexdummyfont
  1326. \let\r=\indexdummyfont
  1327. \let\i=\indexdummyfont
  1328. \let\b=\indexdummyfont
  1329. \let\emph=\indexdummyfont
  1330. \let\strong=\indexdummyfont
  1331. \let\cite=\indexdummyfont
  1332. \let\sc=\indexdummyfont
  1333. %Don't no-op \tt, since it isn't a user-level command
  1334. % and is used in the definitions of the active chars like <, >, |...
  1335. %\let\tt=\indexdummyfont
  1336. \let\tclose=\indexdummyfont
  1337. \let\code=\indexdummyfont
  1338. \let\file=\indexdummyfont
  1339. \let\samp=\indexdummyfont
  1340. \let\kbd=\indexdummyfont
  1341. \let\key=\indexdummyfont
  1342. \let\var=\indexdummyfont
  1343. \let\TeX=\indexdummytex
  1344. \let\dots=\indexdummydots
  1345. % To define \realbackslash, we must make \ not be an escape.
  1346. % We must first make another character (@) an escape
  1347. % so we do not become unable to do a definition.
  1348. {\catcode`\@=0 \catcode`\\=\other
  1349. @gdef@realbackslash{\}}
  1350. \let\indexbackslash=0  %overridden during \printindex.
  1351. \def\doind #1#2{%
  1352. {\count10=\lastpenalty %
  1353. {\indexdummies % Must do this here, since \bf, etc expand at this stage
  1354. \escapechar=`\\%
  1355. {\let\folio=0% Expand all macros now EXCEPT \folio
  1356. \def\rawbackslashxx{\indexbackslash}% \indexbackslash isn't defined now
  1357. % so it will be output as is; and it will print as backslash in the indx.
  1358. % Now process the index-string once, with all font commands turned off,
  1359. % to get the string to sort the index by.
  1360. {\indexnofonts
  1361. \xdef\temp1{#2}%
  1362. % Now produce the complete index entry.  We process the index-string again,
  1363. % this time with font commands expanded, to get what to print in the index.
  1364. \edef\temp{%
  1365. \write \csname#1indfile\endcsname{%
  1366. \realbackslash entry {\temp1}{\folio}{#2}}}%
  1367. \temp }%
  1368. }\penalty\count10}}
  1369. \def\dosubind #1#2#3{%
  1370. {\count10=\lastpenalty %
  1371. {\indexdummies % Must do this here, since \bf, etc expand at this stage
  1372. \escapechar=`\\%
  1373. {\let\folio=0%
  1374. \def\rawbackslashxx{\indexbackslash}%
  1375. % Now process the index-string once, with all font commands turned off,
  1376. % to get the string to sort the index by.
  1377. {\indexnofonts
  1378. \xdef\temp1{#2 #3}%
  1379. % Now produce the complete index entry.  We process the index-string again,
  1380. % this time with font commands expanded, to get what to print in the index.
  1381. \edef\temp{%
  1382. \write \csname#1indfile\endcsname{%
  1383. \realbackslash entry {\temp1}{\folio}{#2}{#3}}}%
  1384. \temp }%
  1385. }\penalty\count10}}
  1386. % The index entry written in the file actually looks like
  1387. %  \entry {sortstring}{page}{topic}
  1388. %  \entry {sortstring}{page}{topic}{subtopic}
  1389. % The texindex program reads in these files and writes files
  1390. % containing these kinds of lines:
  1391. %  \initial {c}
  1392. %     before the first topic whose initial is c
  1393. %  \entry {topic}{pagelist}
  1394. %     for a topic that is used without subtopics
  1395. %  \primary {topic}
  1396. %     for the beginning of a topic that is used with subtopics
  1397. %  \secondary {subtopic}{pagelist}
  1398. %     for each subtopic.
  1399. % Define the user-accessible indexing commands 
  1400. % @findex, @vindex, @kindex, @cindex.
  1401. \def\findex {\fnindex}
  1402. \def\kindex {\kyindex}
  1403. \def\cindex {\cpindex}
  1404. \def\vindex {\vrindex}
  1405. \def\tindex {\tpindex}
  1406. \def\pindex {\pgindex}
  1407. \def\cindexsub {\begingroup\obeylines\cindexsub}
  1408. {\obeylines %
  1409. \gdef\cindexsub "#1" #2^^M{\endgroup %
  1410. \dosubind{cp}{#2}{#1}}}
  1411. % Define the macros used in formatting output of the sorted index material.
  1412. % This is what you call to cause a particular index to get printed.
  1413. % Write
  1414. % @unnumbered Function Index
  1415. % @printindex fn
  1416. \def\printindex{\parsearg\doprintindex}
  1417. \def\doprintindex#1{%
  1418.   \tex
  1419.   \dobreak \chapheadingskip {10000}
  1420.   \catcode`\%=\other\catcode`\&=\other\catcode`\#=\other
  1421.   \catcode`\$=\other\catcode`\_=\other
  1422.   \catcode`\~=\other
  1423.   % The following don't help, since the chars were translated
  1424.   % when the raw index was written, and their fonts were discarded
  1425.   % due to \indexnofonts.
  1426.   %\catcode`\"=\active
  1427.   %\catcode`\^=\active
  1428.   %\catcode`\_=\active
  1429.   %\catcode`\|=\active
  1430.   %\catcode`\<=\active
  1431.   %\catcode`\>=\active
  1432.   % %
  1433.   \def\indexbackslash{\rawbackslashxx}
  1434.   \indexfonts\rm \tolerance=9500 \advance\baselineskip -1pt
  1435.   \begindoublecolumns
  1436.   % See if the index file exists and is nonempty.
  1437.   \openin 1 \jobname.#1s
  1438.   \ifeof 1 
  1439.     % \enddoublecolumns gets confused if there is no text in the index,
  1440.     % and it loses the chapter title and the aux file entries for the
  1441.     % index.  The easiest way to prevent this problem is to make sure
  1442.     % there is some text.
  1443.     (Index is nonexistent)
  1444.     \else
  1445.     %
  1446.     % If the index file exists but is empty, then \openin leaves \ifeof
  1447.     % false.  We have to make TeX try to read something from the file, so
  1448.     % it can discover if there is anything in it.
  1449.     \read 1 to \temp
  1450.     \ifeof 1
  1451.       (Index is empty)
  1452.     \else
  1453.       \input \jobname.#1s
  1454.     \fi
  1455.   \fi
  1456.   \closein 1
  1457.   \enddoublecolumns
  1458.   \Etex
  1459. % These macros are used by the sorted index file itself.
  1460. % Change them to control the appearance of the index.
  1461. % Same as \bigskipamount except no shrink.
  1462. % \balancecolumns gets confused if there is any shrink.
  1463. \newskip\initialskipamount \initialskipamount 12pt plus4pt
  1464. \def\initial #1{%
  1465. {\let\tentt=\sectt \let\tt=\sectt \let\sf=\sectt
  1466. \ifdim\lastskip<\initialskipamount
  1467. \removelastskip \penalty-200 \vskip \initialskipamount\fi
  1468. \line{\secbf#1\hfill}\kern 2pt\penalty10000}}
  1469. % This typesets a paragraph consisting of #1, dot leaders, and then #2
  1470. % flush to the right margin.  It is used for index and table of contents
  1471. % entries.  The paragraph is indented by \leftskip.
  1472. \def\entry #1#2{\begingroup
  1473.   % Start a new paragraph if necessary, so our assignments below can't
  1474.   % affect previous text.
  1475.   \par
  1476.   % Do not fill out the last line with white space.
  1477.   \parfillskip = 0in
  1478.   % No extra space above this paragraph.
  1479.   \parskip = 0in
  1480.   % Do not prefer a separate line ending with a hyphen to fewer lines.
  1481.   \finalhyphendemerits = 0
  1482.   % \hangindent is only relevant when the entry text and page number
  1483.   % don't both fit on one line.  In that case, bob suggests starting the
  1484.   % dots pretty far over on the line.  Unfortunately, a large
  1485.   % indentation looks wrong when the entry text itself is broken across
  1486.   % lines.  So we use a small indentation and put up with long leaders.
  1487.   % \hangafter is reset to 1 (which is the value we want) at the start
  1488.   % of each paragraph, so we need not do anything with that.
  1489.   \hangindent=2em
  1490.   % When the entry text needs to be broken, just fill out the first line
  1491.   % with blank space.
  1492.   \rightskip = 0pt plus1fil
  1493.   % Start a ``paragraph'' for the index entry so the line breaking
  1494.   % parameters we've set above will have an effect.
  1495.   \noindent
  1496.   % Insert the text of the index entry.  TeX will do line-breaking on it.
  1497.   #1%
  1498.   % If we must, put the page number on a line of its own, and fill out
  1499.   % this line with blank space.  (The \hfil is overwhelmed with the
  1500.   % fill leaders glue in \indexdotfill if the page number does fit.)
  1501.   \hfil\penalty50
  1502.   \null\nobreak\indexdotfill % Have leaders before the page number.
  1503.   % The `\ ' here is removed by the implicit \unskip that TeX does as
  1504.   % part of (the primitive) \par.  Without it, a spurious underfull
  1505.   % \hbox ensues.
  1506.   \ #2% The page number ends the paragraph.
  1507.   \par
  1508. \endgroup}
  1509. % Like \dotfill except takes at least 1 em.
  1510. \def\indexdotfill{\cleaders
  1511.   \hbox{$\mathsurround=0pt \mkern1.5mu . \mkern1.5mu$}\hskip 1em plus 1fill}
  1512. \def\primary #1{\line{#1\hfil}}
  1513. \newskip\secondaryindent \secondaryindent=0.5cm
  1514. \def\secondary #1#2{
  1515. {\parfillskip=0in \parskip=0in
  1516. \hangindent =1in \hangafter=1
  1517. \noindent\hskip\secondaryindent\hbox{#1}\indexdotfill #2\par
  1518. %% Define two-column mode, which is used in indexes.
  1519. %% Adapted from the TeXbook, page 416.
  1520. \catcode `\@=11
  1521. \newbox\partialpage
  1522. \newdimen\doublecolumnhsize
  1523. \def\begindoublecolumns{\begingroup
  1524.   % Grab any single-column material above us.
  1525.   \output = {\global\setbox\partialpage
  1526.     =\vbox{\unvbox255\kern -\topskip \kern \baselineskip}}%
  1527.   \eject
  1528.   % Now switch to the double-column output routine.
  1529.   \output={\doublecolumnout}%
  1530.   % Change the page size parameters.  We could do this once outside this
  1531.   % routine, in each of @smallbook, @afourpaper, and the default 8.5x11
  1532.   % format, but then we repeat the same computation.  Repeating a couple
  1533.   % of assignments once per index is clearly meaningless for the
  1534.   % execution time, so we may as well do it once.
  1535.   % First we halve the line length, less a little for the gutter between
  1536.   % the columns.  We compute the gutter based on the line length, so it
  1537.   % changes automatically with the paper format.  The magic constant
  1538.   % below is chosen so that the gutter has the same value (well, +- <
  1539.   % 1pt) as it did when we hard-coded it.
  1540.   % We put the result in a separate register, \doublecolumhsize, so we
  1541.   % can restore it in \pagesofar, after \hsize itself has (potentially)
  1542.   % been clobbered.
  1543.   \doublecolumnhsize = \hsize
  1544.     \advance\doublecolumnhsize by -.04154\hsize
  1545.     \divide\doublecolumnhsize by 2
  1546.   \hsize = \doublecolumnhsize
  1547.   % Double the \vsize as well.  (We don't need a separate register here,
  1548.   % since nobody clobbers \vsize.)
  1549.   \vsize = 2\vsize
  1550.   \doublecolumnpagegoal
  1551. \def\enddoublecolumns{\eject \endgroup \pagegoal=\vsize \unvbox\partialpage}
  1552. \def\doublecolumnsplit{\splittopskip=\topskip \splitmaxdepth=\maxdepth
  1553.   \global\dimen@=\pageheight \global\advance\dimen@ by-\ht\partialpage
  1554.   \global\setbox1=\vsplit255 to\dimen@ \global\setbox0=\vbox{\unvbox1}
  1555.   \global\setbox3=\vsplit255 to\dimen@ \global\setbox2=\vbox{\unvbox3}
  1556.   \ifdim\ht0>\dimen@ \setbox255=\vbox{\unvbox0\unvbox2} \global\setbox255=\copy5 \fi
  1557.   \ifdim\ht2>\dimen@ \setbox255=\vbox{\unvbox0\unvbox2} \global\setbox255=\copy5 \fi
  1558. \def\doublecolumnpagegoal{%
  1559.   \dimen@=\vsize \advance\dimen@ by-2\ht\partialpage \global\pagegoal=\dimen@
  1560. \def\pagesofar{\unvbox\partialpage %
  1561.   \hsize=\doublecolumnhsize % have to restore this since output routine
  1562.   \wd0=\hsize \wd2=\hsize \hbox to\pagewidth{\box0\hfil\box2}}
  1563. \def\doublecolumnout{%
  1564.   \setbox5=\copy255
  1565.   {\vbadness=10000 \doublecolumnsplit}
  1566.   \ifvbox255
  1567.     \setbox0=\vtop to\dimen@{\unvbox0}
  1568.     \setbox2=\vtop to\dimen@{\unvbox2}
  1569.     \onepageout\pagesofar \unvbox255 \penalty\outputpenalty
  1570.   \else
  1571.     \setbox0=\vbox{\unvbox5}
  1572.     \ifvbox0
  1573.       \dimen@=\ht0 \advance\dimen@ by\topskip \advance\dimen@ by-\baselineskip
  1574.       \divide\dimen@ by2 \splittopskip=\topskip \splitmaxdepth=\maxdepth
  1575.       {\vbadness=10000
  1576.     \loop \global\setbox5=\copy0
  1577.           \setbox1=\vsplit5 to\dimen@
  1578.           \setbox3=\vsplit5 to\dimen@
  1579.           \ifvbox5 \global\advance\dimen@ by1pt \repeat
  1580.         \setbox0=\vbox to\dimen@{\unvbox1}
  1581.         \setbox2=\vbox to\dimen@{\unvbox3}
  1582.         \global\setbox\partialpage=\vbox{\pagesofar}
  1583.         \doublecolumnpagegoal
  1584.       }
  1585.     \fi
  1586.   \fi
  1587. \catcode `\@=\other
  1588. \message{sectioning,}
  1589. % Define chapters, sections, etc.
  1590. \newcount \chapno
  1591. \newcount \secno        \secno=0
  1592. \newcount \subsecno     \subsecno=0
  1593. \newcount \subsubsecno  \subsubsecno=0
  1594. % This counter is funny since it counts through charcodes of letters A, B, ...
  1595. \newcount \appendixno  \appendixno = `\@
  1596. \def\appendixletter{\char\the\appendixno}
  1597. \newwrite \contentsfile
  1598. % This is called from \setfilename.
  1599. \def\opencontents{\openout \contentsfile = \jobname.toc}
  1600. % Each @chapter defines this as the name of the chapter.
  1601. % page headings and footings can use it.  @section does likewise
  1602. \def\thischapter{} \def\thissection{}
  1603. \def\seccheck#1{\if \pageno<0 %
  1604. \errmessage{@#1 not allowed after generating table of contents}\fi
  1605. \def\chapternofonts{%
  1606. \let\rawbackslash=\relax%
  1607. \let\frenchspacing=\relax%
  1608. \def\result{\realbackslash result}
  1609. \def\equiv{\realbackslash equiv}
  1610. \def\expansion{\realbackslash expansion}
  1611. \def\print{\realbackslash print}
  1612. \def\TeX{\realbackslash TeX}
  1613. \def\dots{\realbackslash dots}
  1614. \def\copyright{\realbackslash copyright}
  1615. \def\tt{\realbackslash tt}
  1616. \def\bf{\realbackslash bf }
  1617. \def\w{\realbackslash w}
  1618. \def\less{\realbackslash less}
  1619. \def\gtr{\realbackslash gtr}
  1620. \def\hat{\realbackslash hat}
  1621. \def\char{\realbackslash char}
  1622. \def\tclose##1{\realbackslash tclose {##1}}
  1623. \def\code##1{\realbackslash code {##1}}
  1624. \def\samp##1{\realbackslash samp {##1}}
  1625. \def\r##1{\realbackslash r {##1}}
  1626. \def\b##1{\realbackslash b {##1}}
  1627. \def\key##1{\realbackslash key {##1}}
  1628. \def\file##1{\realbackslash file {##1}}
  1629. \def\kbd##1{\realbackslash kbd {##1}}
  1630. % These are redefined because @smartitalic wouldn't work inside xdef.
  1631. \def\i##1{\realbackslash i {##1}}
  1632. \def\cite##1{\realbackslash cite {##1}}
  1633. \def\var##1{\realbackslash var {##1}}
  1634. \def\emph##1{\realbackslash emph {##1}}
  1635. \def\dfn##1{\realbackslash dfn {##1}}
  1636. \newcount\absseclevel % used to calculate proper heading level
  1637. \newcount\secbase\secbase=0 % @raise/lowersections modify this count
  1638. % @raisesections: treat @section as chapter, @subsection as section, etc.
  1639. \def\raisesections{\global\advance\secbase by -1}
  1640. \let\up=\raisesections % original BFox name
  1641. % @lowersections: treat @chapter as section, @section as subsection, etc.
  1642. \def\lowersections{\global\advance\secbase by 1}
  1643. \let\down=\lowersections % original BFox name
  1644. % Choose a numbered-heading macro
  1645. % #1 is heading level if unmodified by @raisesections or @lowersections
  1646. % #2 is text for heading
  1647. \def\numhead#1#2{\absseclevel=\secbase\advance\absseclevel by #1
  1648. \ifcase\absseclevel
  1649.   \chapterzzz{#2}
  1650.   \seczzz{#2}
  1651.   \numberedsubseczzz{#2}
  1652.   \numberedsubsubseczzz{#2}
  1653. \else
  1654.   \ifnum \absseclevel<0
  1655.     \chapterzzz{#2}
  1656.   \else
  1657.     \numberedsubsubseczzz{#2}
  1658.   \fi
  1659. % like \numhead, but chooses appendix heading levels
  1660. \def\apphead#1#2{\absseclevel=\secbase\advance\absseclevel by #1
  1661. \ifcase\absseclevel
  1662.   \appendixzzz{#2}
  1663.   \appendixsectionzzz{#2}
  1664.   \appendixsubseczzz{#2}
  1665.   \appendixsubsubseczzz{#2}
  1666. \else
  1667.   \ifnum \absseclevel<0
  1668.     \appendixzzz{#2}
  1669.   \else
  1670.     \appendixsubsubseczzz{#2}
  1671.   \fi
  1672. % like \numhead, but chooses numberless heading levels
  1673. \def\unnmhead#1#2{\absseclevel=\secbase\advance\absseclevel by #1
  1674. \ifcase\absseclevel
  1675.   \unnumberedzzz{#2}
  1676.   \unnumberedseczzz{#2}
  1677.   \unnumberedsubseczzz{#2}
  1678.   \unnumberedsubsubseczzz{#2}
  1679. \else
  1680.   \ifnum \absseclevel<0
  1681.     \unnumberedzzz{#2}
  1682.   \else
  1683.     \unnumberedsubsubseczzz{#2}
  1684.   \fi
  1685. \def\thischaptername{No Chapter Title}
  1686. \outer\def\chapter{\parsearg\chapteryyy}
  1687. \def\chapteryyy #1{\numhead0{#1}} % normally numhead0 calls chapterzzz
  1688. \def\chapterzzz #1{\seccheck{chapter}%
  1689. \secno=0 \subsecno=0 \subsubsecno=0
  1690. \global\advance \chapno by 1 \message{Chapter \the\chapno}%
  1691. \chapmacro {#1}{\the\chapno}%
  1692. \gdef\thissection{#1}%
  1693. \gdef\thischaptername{#1}%
  1694. % We don't substitute the actual chapter name into \thischapter
  1695. % because we don't want its macros evaluated now.
  1696. \xdef\thischapter{Chapter \the\chapno: \noexpand\thischaptername}%
  1697. {\chapternofonts%
  1698. \edef\temp{{\realbackslash chapentry {#1}{\the\chapno}{\noexpand\folio}}}%
  1699. \escapechar=`\\%
  1700. \write \contentsfile \temp  %
  1701. \donoderef %
  1702. \global\let\section = \numberedsec
  1703. \global\let\subsection = \numberedsubsec
  1704. \global\let\subsubsection = \numberedsubsubsec
  1705. \outer\def\appendix{\parsearg\appendixyyy}
  1706. \def\appendixyyy #1{\apphead0{#1}} % normally apphead0 calls appendixzzz
  1707. \def\appendixzzz #1{\seccheck{appendix}%
  1708. \secno=0 \subsecno=0 \subsubsecno=0
  1709. \global\advance \appendixno by 1 \message{Appendix \appendixletter}%
  1710. \chapmacro {#1}{Appendix \appendixletter}%
  1711. \gdef\thissection{#1}%
  1712. \gdef\thischaptername{#1}%
  1713. \xdef\thischapter{Appendix \appendixletter: \noexpand\thischaptername}%
  1714. {\chapternofonts%
  1715. \edef\temp{{\realbackslash chapentry 
  1716.   {#1}{Appendix \appendixletter}{\noexpand\folio}}}%
  1717. \escapechar=`\\%
  1718. \write \contentsfile \temp  %
  1719. \appendixnoderef %
  1720. \global\let\section = \appendixsec
  1721. \global\let\subsection = \appendixsubsec
  1722. \global\let\subsubsection = \appendixsubsubsec
  1723. \outer\def\top{\parsearg\unnumberedyyy}
  1724. \outer\def\unnumbered{\parsearg\unnumberedyyy}
  1725. \def\unnumberedyyy #1{\unnmhead0{#1}} % normally unnmhead0 calls unnumberedzzz
  1726. \def\unnumberedzzz #1{\seccheck{unnumbered}%
  1727. \secno=0 \subsecno=0 \subsubsecno=0
  1728. % This used to be simply \message{#1}, but TeX fully expands the
  1729. % argument to \message.  Therefore, if #1 contained @-commands, TeX
  1730. % expanded them.  For example, in `@unnumbered The @cite{Book}', TeX
  1731. % expanded @cite (which turns out to cause errors because \cite is meant
  1732. % to be executed, not expanded).  
  1733. % Anyway, we don't want the fully-expanded definition of @cite to appear
  1734. % as a result of the \message, we just want `@cite' itself.  We use
  1735. % \the<toks register> to achieve this: TeX expands \the<toks> only once,
  1736. % simply yielding the contents of the <toks register>.
  1737. \toks0 = {#1}\message{(\the\toks0)}%
  1738. \unnumbchapmacro {#1}%
  1739. \gdef\thischapter{#1}\gdef\thissection{#1}%
  1740. {\chapternofonts%
  1741. \edef\temp{{\realbackslash unnumbchapentry {#1}{\noexpand\folio}}}%
  1742. \escapechar=`\\%
  1743. \write \contentsfile \temp  %
  1744. \unnumbnoderef %
  1745. \global\let\section = \unnumberedsec
  1746. \global\let\subsection = \unnumberedsubsec
  1747. \global\let\subsubsection = \unnumberedsubsubsec
  1748. \outer\def\numberedsec{\parsearg\secyyy}
  1749. \def\secyyy #1{\numhead1{#1}} % normally calls seczzz
  1750. \def\seczzz #1{\seccheck{section}%
  1751. \subsecno=0 \subsubsecno=0 \global\advance \secno by 1 %
  1752. \gdef\thissection{#1}\secheading {#1}{\the\chapno}{\the\secno}%
  1753. {\chapternofonts%
  1754. \edef\temp{{\realbackslash secentry %
  1755. {#1}{\the\chapno}{\the\secno}{\noexpand\folio}}}%
  1756. \escapechar=`\\%
  1757. \write \contentsfile \temp %
  1758. \donoderef %
  1759. \penalty 10000 %
  1760. \outer\def\appenixsection{\parsearg\appendixsecyyy}
  1761. \outer\def\appendixsec{\parsearg\appendixsecyyy}
  1762. \def\appendixsecyyy #1{\apphead1{#1}} % normally calls appendixsectionzzz
  1763. \def\appendixsectionzzz #1{\seccheck{appendixsection}%
  1764. \subsecno=0 \subsubsecno=0 \global\advance \secno by 1 %
  1765. \gdef\thissection{#1}\secheading {#1}{\appendixletter}{\the\secno}%
  1766. {\chapternofonts%
  1767. \edef\temp{{\realbackslash secentry %
  1768. {#1}{\appendixletter}{\the\secno}{\noexpand\folio}}}%
  1769. \escapechar=`\\%
  1770. \write \contentsfile \temp %
  1771. \appendixnoderef %
  1772. \penalty 10000 %
  1773. \outer\def\unnumberedsec{\parsearg\unnumberedsecyyy}
  1774. \def\unnumberedsecyyy #1{\unnmhead1{#1}} % normally calls unnumberedseczzz
  1775. \def\unnumberedseczzz #1{\seccheck{unnumberedsec}%
  1776. \plainsecheading {#1}\gdef\thissection{#1}%
  1777. {\chapternofonts%
  1778. \edef\temp{{\realbackslash unnumbsecentry{#1}{\noexpand\folio}}}%
  1779. \escapechar=`\\%
  1780. \write \contentsfile \temp %
  1781. \unnumbnoderef %
  1782. \penalty 10000 %
  1783. \outer\def\numberedsubsec{\parsearg\numberedsubsecyyy}
  1784. \def\numberedsubsecyyy #1{\numhead2{#1}} % normally calls numberedsubseczzz
  1785. \def\numberedsubseczzz #1{\seccheck{subsection}%
  1786. \gdef\thissection{#1}\subsubsecno=0 \global\advance \subsecno by 1 %
  1787. \subsecheading {#1}{\the\chapno}{\the\secno}{\the\subsecno}%
  1788. {\chapternofonts%
  1789. \edef\temp{{\realbackslash subsecentry %
  1790. {#1}{\the\chapno}{\the\secno}{\the\subsecno}{\noexpand\folio}}}%
  1791. \escapechar=`\\%
  1792. \write \contentsfile \temp %
  1793. \donoderef %
  1794. \penalty 10000 %
  1795. \outer\def\appendixsubsec{\parsearg\appendixsubsecyyy}
  1796. \def\appendixsubsecyyy #1{\apphead2{#1}} % normally calls appendixsubseczzz
  1797. \def\appendixsubseczzz #1{\seccheck{appendixsubsec}%
  1798. \gdef\thissection{#1}\subsubsecno=0 \global\advance \subsecno by 1 %
  1799. \subsecheading {#1}{\appendixletter}{\the\secno}{\the\subsecno}%
  1800. {\chapternofonts%
  1801. \edef\temp{{\realbackslash subsecentry %
  1802. {#1}{\appendixletter}{\the\secno}{\the\subsecno}{\noexpand\folio}}}%
  1803. \escapechar=`\\%
  1804. \write \contentsfile \temp %
  1805. \appendixnoderef %
  1806. \penalty 10000 %
  1807. \outer\def\unnumberedsubsec{\parsearg\unnumberedsubsecyyy}
  1808. \def\unnumberedsubsecyyy #1{\unnmhead2{#1}} %normally calls unnumberedsubseczzz
  1809. \def\unnumberedsubseczzz #1{\seccheck{unnumberedsubsec}%
  1810. \plainsecheading {#1}\gdef\thissection{#1}%
  1811. {\chapternofonts%
  1812. \edef\temp{{\realbackslash unnumbsubsecentry{#1}{\noexpand\folio}}}%
  1813. \escapechar=`\\%
  1814. \write \contentsfile \temp %
  1815. \unnumbnoderef %
  1816. \penalty 10000 %
  1817. \outer\def\numberedsubsubsec{\parsearg\numberedsubsubsecyyy}
  1818. \def\numberedsubsubsecyyy #1{\numhead3{#1}} % normally numberedsubsubseczzz
  1819. \def\numberedsubsubseczzz #1{\seccheck{subsubsection}%
  1820. \gdef\thissection{#1}\global\advance \subsubsecno by 1 %
  1821. \subsubsecheading {#1}
  1822.   {\the\chapno}{\the\secno}{\the\subsecno}{\the\subsubsecno}%
  1823. {\chapternofonts%
  1824. \edef\temp{{\realbackslash subsubsecentry %
  1825.   {#1}
  1826.   {\the\chapno}{\the\secno}{\the\subsecno}{\the\subsubsecno}
  1827.   {\noexpand\folio}}}%
  1828. \escapechar=`\\%
  1829. \write \contentsfile \temp %
  1830. \donoderef %
  1831. \penalty 10000 %
  1832. \outer\def\appendixsubsubsec{\parsearg\appendixsubsubsecyyy}
  1833. \def\appendixsubsubsecyyy #1{\apphead3{#1}} % normally appendixsubsubseczzz
  1834. \def\appendixsubsubseczzz #1{\seccheck{appendixsubsubsec}%
  1835. \gdef\thissection{#1}\global\advance \subsubsecno by 1 %
  1836. \subsubsecheading {#1}
  1837.   {\appendixletter}{\the\secno}{\the\subsecno}{\the\subsubsecno}%
  1838. {\chapternofonts%
  1839. \edef\temp{{\realbackslash subsubsecentry{#1}%
  1840.   {\appendixletter}
  1841.   {\the\secno}{\the\subsecno}{\the\subsubsecno}{\noexpand\folio}}}%
  1842. \escapechar=`\\%
  1843. \write \contentsfile \temp %
  1844. \appendixnoderef %
  1845. \penalty 10000 %
  1846. \outer\def\unnumberedsubsubsec{\parsearg\unnumberedsubsubsecyyy}
  1847. \def\unnumberedsubsubsecyyy #1{\unnmhead3{#1}} %normally unnumberedsubsubseczzz
  1848. \def\unnumberedsubsubseczzz #1{\seccheck{unnumberedsubsubsec}%
  1849. \plainsecheading {#1}\gdef\thissection{#1}%
  1850. {\chapternofonts%
  1851. \edef\temp{{\realbackslash unnumbsubsubsecentry{#1}{\noexpand\folio}}}%
  1852. \escapechar=`\\%
  1853. \write \contentsfile \temp %
  1854. \unnumbnoderef %
  1855. \penalty 10000 %
  1856. % These are variants which are not "outer", so they can appear in @ifinfo.
  1857. % Actually, they should now be obsolete; ordinary section commands should work.
  1858. \def\infotop{\parsearg\unnumberedzzz}
  1859. \def\infounnumbered{\parsearg\unnumberedzzz}
  1860. \def\infounnumberedsec{\parsearg\unnumberedseczzz}
  1861. \def\infounnumberedsubsec{\parsearg\unnumberedsubseczzz}
  1862. \def\infounnumberedsubsubsec{\parsearg\unnumberedsubsubseczzz}
  1863. \def\infoappendix{\parsearg\appendixzzz}
  1864. \def\infoappendixsec{\parsearg\appendixseczzz}
  1865. \def\infoappendixsubsec{\parsearg\appendixsubseczzz}
  1866. \def\infoappendixsubsubsec{\parsearg\appendixsubsubseczzz}
  1867. \def\infochapter{\parsearg\chapterzzz}
  1868. \def\infosection{\parsearg\sectionzzz}
  1869. \def\infosubsection{\parsearg\subsectionzzz}
  1870. \def\infosubsubsection{\parsearg\subsubsectionzzz}
  1871. % These macros control what the section commands do, according
  1872. % to what kind of chapter we are in (ordinary, appendix, or unnumbered).
  1873. % Define them by default for a numbered chapter.
  1874. \global\let\section = \numberedsec
  1875. \global\let\subsection = \numberedsubsec
  1876. \global\let\subsubsection = \numberedsubsubsec
  1877. % Define @majorheading, @heading and @subheading
  1878. % NOTE on use of \vbox for chapter headings, section headings, and
  1879. % such:
  1880. %    1) We use \vbox rather than the earlier \line to permit
  1881. %       overlong headings to fold.
  1882. %    2) \hyphenpenalty is set to 10000 because hyphenation in a
  1883. %       heading is obnoxious; this forbids it.
  1884. %       3) Likewise, headings look best if no \parindent is used, and
  1885. %          if justification is not attempted.  Hence \raggedright.
  1886. \def\majorheading{\parsearg\majorheadingzzz}
  1887. \def\majorheadingzzz #1{%
  1888. {\advance\chapheadingskip by 10pt \chapbreak }%
  1889. {\chapfonts \vbox{\hyphenpenalty=10000\tolerance=5000
  1890.                   \parindent=0pt\raggedright
  1891.                   \rm #1\hfill}}\bigskip \par\penalty 200}
  1892. \def\chapheading{\parsearg\chapheadingzzz}
  1893. \def\chapheadingzzz #1{\chapbreak %
  1894. {\chapfonts \vbox{\hyphenpenalty=10000\tolerance=5000
  1895.                   \parindent=0pt\raggedright
  1896.                   \rm #1\hfill}}\bigskip \par\penalty 200}
  1897. \def\heading{\parsearg\secheadingi}
  1898. \def\subheading{\parsearg\subsecheadingi}
  1899. \def\subsubheading{\parsearg\subsubsecheadingi}
  1900. % These macros generate a chapter, section, etc. heading only
  1901. % (including whitespace, linebreaking, etc. around it),
  1902. % given all the information in convenient, parsed form.
  1903. %%% Args are the skip and penalty (usually negative)
  1904. \def\dobreak#1#2{\par\ifdim\lastskip<#1\removelastskip\penalty#2\vskip#1\fi}
  1905. \def\setchapterstyle #1 {\csname CHAPF#1\endcsname}
  1906. %%% Define plain chapter starts, and page on/off switching for it
  1907. % Parameter controlling skip before chapter headings (if needed)
  1908. \newskip \chapheadingskip \chapheadingskip = 30pt plus 8pt minus 4pt
  1909. \def\chapbreak{\dobreak \chapheadingskip {-4000}}
  1910. \def\chappager{\par\vfill\supereject}
  1911. \def\chapoddpage{\chappager \ifodd\pageno \else \hbox to 0pt{} \chappager\fi}
  1912. \def\setchapternewpage #1 {\csname CHAPPAG#1\endcsname}
  1913. \def\CHAPPAGoff{
  1914. \global\let\pchapsepmacro=\chapbreak
  1915. \global\let\pagealignmacro=\chappager}
  1916. \def\CHAPPAGon{
  1917. \global\let\pchapsepmacro=\chappager
  1918. \global\let\pagealignmacro=\chappager
  1919. \global\def\HEADINGSon{\HEADINGSsingle}}
  1920. \def\CHAPPAGodd{
  1921. \global\let\pchapsepmacro=\chapoddpage
  1922. \global\let\pagealignmacro=\chapoddpage
  1923. \global\def\HEADINGSon{\HEADINGSdouble}}
  1924. \CHAPPAGon
  1925. \def\CHAPFplain{
  1926. \global\let\chapmacro=\chfplain
  1927. \global\let\unnumbchapmacro=\unnchfplain}
  1928. \def\chfplain #1#2{%
  1929.   \pchapsepmacro
  1930.     \chapfonts \vbox{\hyphenpenalty=10000\tolerance=5000
  1931.                      \parindent=0pt\raggedright
  1932.                      \rm #2\enspace #1}%
  1933.   \bigskip
  1934.   \penalty5000
  1935. \def\unnchfplain #1{%
  1936. \pchapsepmacro %
  1937. {\chapfonts \vbox{\hyphenpenalty=10000\tolerance=5000
  1938.                   \parindent=0pt\raggedright
  1939.                   \rm #1\hfill}}\bigskip \par\penalty 10000 %
  1940. \CHAPFplain % The default
  1941. \def\unnchfopen #1{%
  1942. \chapoddpage {\chapfonts \vbox{\hyphenpenalty=10000\tolerance=5000
  1943.                        \parindent=0pt\raggedright
  1944.                        \rm #1\hfill}}\bigskip \par\penalty 10000 %
  1945. \def\chfopen #1#2{\chapoddpage {\chapfonts
  1946. \vbox to 3in{\vfil \hbox to\hsize{\hfil #2} \hbox to\hsize{\hfil #1} \vfil}}%
  1947. \par\penalty 5000 %
  1948. \def\CHAPFopen{
  1949. \global\let\chapmacro=\chfopen
  1950. \global\let\unnumbchapmacro=\unnchfopen}
  1951. % Parameter controlling skip before section headings.
  1952. \newskip \subsecheadingskip  \subsecheadingskip = 17pt plus 8pt minus 4pt
  1953. \def\subsecheadingbreak{\dobreak \subsecheadingskip {-500}}
  1954. \newskip \secheadingskip  \secheadingskip = 21pt plus 8pt minus 4pt
  1955. \def\secheadingbreak{\dobreak \secheadingskip {-1000}}
  1956. % @paragraphindent  is defined for the Info formatting commands only.
  1957. \let\paragraphindent=\comment
  1958. % Section fonts are the base font at magstep2, which produces
  1959. % a size a bit more than 14 points in the default situation.    
  1960. \def\secheading #1#2#3{\secheadingi {#2.#3\enspace #1}}
  1961. \def\plainsecheading #1{\secheadingi {#1}}
  1962. \def\secheadingi #1{{\advance \secheadingskip by \parskip %
  1963. \secheadingbreak}%
  1964. {\secfonts \vbox{\hyphenpenalty=10000\tolerance=5000
  1965.                  \parindent=0pt\raggedright
  1966.                  \rm #1\hfill}}%
  1967. \ifdim \parskip<10pt \kern 10pt\kern -\parskip\fi \penalty 10000 }
  1968. % Subsection fonts are the base font at magstep1, 
  1969. % which produces a size of 12 points.
  1970. \def\subsecheading #1#2#3#4{\subsecheadingi {#2.#3.#4\enspace #1}}
  1971. \def\subsecheadingi #1{{\advance \subsecheadingskip by \parskip %
  1972. \subsecheadingbreak}%
  1973. {\subsecfonts \vbox{\hyphenpenalty=10000\tolerance=5000
  1974.                      \parindent=0pt\raggedright
  1975.                      \rm #1\hfill}}%
  1976. \ifdim \parskip<10pt \kern 10pt\kern -\parskip\fi \penalty 10000 }
  1977. \def\subsubsecfonts{\subsecfonts} % Maybe this should change:
  1978.                   % Perhaps make sssec fonts scaled
  1979.                   % magstep half
  1980. \def\subsubsecheading #1#2#3#4#5{\subsubsecheadingi {#2.#3.#4.#5\enspace #1}}
  1981. \def\subsubsecheadingi #1{{\advance \subsecheadingskip by \parskip %
  1982. \subsecheadingbreak}%
  1983. {\subsubsecfonts \vbox{\hyphenpenalty=10000\tolerance=5000
  1984.                        \parindent=0pt\raggedright
  1985.                        \rm #1\hfill}}%
  1986. \ifdim \parskip<10pt \kern 10pt\kern -\parskip\fi \penalty 10000}
  1987. \message{toc printing,}
  1988. % Finish up the main text and prepare to read what we've written
  1989. % to \contentsfile.
  1990. \newskip\contentsrightmargin \contentsrightmargin=1in
  1991. \def\startcontents#1{%
  1992.    \pagealignmacro
  1993.    \immediate\closeout \contentsfile
  1994.    \ifnum \pageno>0
  1995.       \pageno = -1        % Request roman numbered pages.
  1996.    \fi
  1997.    % Don't need to put `Contents' or `Short Contents' in the headline. 
  1998.    % It is abundantly clear what they are.
  1999.    \unnumbchapmacro{#1}\def\thischapter{}%
  2000.    \begingroup           % Set up to handle contents files properly.
  2001.       \catcode`\\=0  \catcode`\{=1  \catcode`\}=2  \catcode`\@=11
  2002.       \raggedbottom             % Worry more about breakpoints than the bottom.
  2003.       \advance\hsize by -\contentsrightmargin % Don't use the full line length.
  2004. % Normal (long) toc.
  2005. \outer\def\contents{%
  2006.    \startcontents{Table of Contents}%
  2007.       \input \jobname.toc
  2008.    \endgroup
  2009.    \vfill \eject
  2010. % And just the chapters.
  2011. \outer\def\summarycontents{%
  2012.    \startcontents{Short Contents}%
  2013.       %
  2014.       \let\chapentry = \shortchapentry
  2015.       \let\unnumbchapentry = \shortunnumberedentry
  2016.       % We want a true roman here for the page numbers.
  2017.       \secfonts
  2018.       \let\rm=\shortcontrm \let\bf=\shortcontbf \let\sl=\shortcontsl
  2019.       \rm
  2020.       \advance\baselineskip by 1pt % Open it up a little.
  2021.       \def\secentry ##1##2##3##4{}
  2022.       \def\unnumbsecentry ##1##2{}
  2023.       \def\subsecentry ##1##2##3##4##5{}
  2024.       \def\unnumbsubsecentry ##1##2{}
  2025.       \def\subsubsecentry ##1##2##3##4##5##6{}
  2026.       \def\unnumbsubsubsecentry ##1##2{}
  2027.       \input \jobname.toc
  2028.    \endgroup
  2029.    \vfill \eject
  2030. \let\shortcontents = \summarycontents
  2031. % These macros generate individual entries in the table of contents.
  2032. % The first argument is the chapter or section name.
  2033. % The last argument is the page number.
  2034. % The arguments in between are the chapter number, section number, ...
  2035. % Chapter-level things, for both the long and short contents.
  2036. \def\chapentry#1#2#3{\dochapentry{#2\labelspace#1}{#3}}
  2037. % See comments in \dochapentry re vbox and related settings
  2038. \def\shortchapentry#1#2#3{%
  2039.   \tocentry{\shortchaplabel{#2}\labelspace #1}{\doshortpageno{#3}}%
  2040. % Typeset the label for a chapter or appendix for the short contents.
  2041. % The arg is, e.g. `Appendix A' for an appendix, or `3' for a chapter.
  2042. % We could simplify the code here by writing out an \appendixentry
  2043. % command in the toc file for appendices, instead of using \chapentry
  2044. % for both, but it doesn't seem worth it.
  2045. \setbox0 = \hbox{\shortcontrm Appendix }
  2046. \newdimen\shortappendixwidth \shortappendixwidth = \wd0
  2047. \def\shortchaplabel#1{%
  2048.   % We typeset #1 in a box of constant width, regardless of the text of
  2049.   % #1, so the chapter titles will come out aligned.
  2050.   \setbox0 = \hbox{#1}%
  2051.   \dimen0 = \ifdim\wd0 > \shortappendixwidth \shortappendixwidth \else 0pt \fi
  2052.   % This space should be plenty, since a single number is .5em, and the
  2053.   % widest letter (M) is 1em, at least in the Computer Modern fonts.
  2054.   % (This space doesn't include the extra space that gets added after
  2055.   % the label; that gets put in in \shortchapentry above.)
  2056.   \advance\dimen0 by 1.1em
  2057.   \hbox to \dimen0{#1\hfil}%
  2058. \def\unnumbchapentry#1#2{\dochapentry{#1}{#2}}
  2059. \def\shortunnumberedentry#1#2{\tocentry{#1}{\doshortpageno{#2}}}
  2060. % Sections.
  2061. \def\secentry#1#2#3#4{\dosecentry{#2.#3\labelspace#1}{#4}}
  2062. \def\unnumbsecentry#1#2{\dosecentry{#1}{#2}}
  2063. % Subsections.
  2064. \def\subsecentry#1#2#3#4#5{\dosubsecentry{#2.#3.#4\labelspace#1}{#5}}
  2065. \def\unnumbsubsecentry#1#2{\dosubsecentry{#1}{#2}}
  2066. % And subsubsections.
  2067. \def\subsubsecentry#1#2#3#4#5#6{%
  2068.   \dosubsubsecentry{#2.#3.#4.#5\labelspace#1}{#6}}
  2069. \def\unnumbsubsubsecentry#1#2{\dosubsubsecentry{#1}{#2}}
  2070. % This parameter controls the indentation of the various levels.
  2071. \newdimen\tocindent \tocindent = 3pc
  2072. % Now for the actual typesetting. In all these, #1 is the text and #2 is the 
  2073. % page number.
  2074. % If the toc has to be broken over pages, we would want to be at chapters 
  2075. % if at all possible; hence the \penalty.
  2076. \def\dochapentry#1#2{%
  2077.    \penalty-300 \vskip\baselineskip
  2078.    \begingroup
  2079.      \chapentryfonts
  2080.      \tocentry{#1}{\dopageno{#2}}%
  2081.    \endgroup
  2082.    \nobreak\vskip .25\baselineskip
  2083. \def\dosecentry#1#2{\begingroup
  2084.   \secentryfonts \leftskip=\tocindent
  2085.   \tocentry{#1}{\dopageno{#2}}%
  2086. \endgroup}
  2087. \def\dosubsecentry#1#2{\begingroup
  2088.   \subsecentryfonts \leftskip=2\tocindent
  2089.   \tocentry{#1}{\dopageno{#2}}%
  2090. \endgroup}
  2091. \def\dosubsubsecentry#1#2{\begingroup
  2092.   \subsubsecentryfonts \leftskip=3\tocindent
  2093.   \tocentry{#1}{\dopageno{#2}}%
  2094. \endgroup}
  2095. % Final typesetting of a toc entry; we use the same \entry macro as for
  2096. % the index entries, but we want to suppress hyphenation here.  (We
  2097. % can't do that in the \entry macro, since index entries might consist
  2098. % of hyphenated-identifiers-that-do-not-fit-on-a-line-and-nothing-else.)
  2099. \def\tocentry#1#2{\begingroup
  2100.   \hyphenpenalty = 10000
  2101.   \entry{#1}{#2}%
  2102. \endgroup}
  2103. % Space between chapter (or whatever) number and the title.
  2104. \def\labelspace{\hskip1em \relax}
  2105. \def\dopageno#1{{\rm #1}}
  2106. \def\doshortpageno#1{{\rm #1}}
  2107. \def\chapentryfonts{\secfonts \rm}
  2108. \def\secentryfonts{\textfonts}
  2109. \let\subsecentryfonts = \textfonts
  2110. \let\subsubsecentryfonts = \textfonts
  2111. \message{environments,}
  2112. % Since these characters are used in examples, it should be an even number of 
  2113. % \tt widths. Each \tt character is 1en, so two makes it 1em.
  2114. % Furthermore, these definitions must come after we define our fonts.
  2115. \newbox\dblarrowbox    \newbox\longdblarrowbox
  2116. \newbox\pushcharbox    \newbox\bullbox
  2117. \newbox\equivbox       \newbox\errorbox
  2118. \let\ptexequiv = \equiv
  2119. %{\tentt
  2120. %\global\setbox\dblarrowbox = \hbox to 1em{\hfil$\Rightarrow$\hfil}
  2121. %\global\setbox\longdblarrowbox = \hbox to 1em{\hfil$\mapsto$\hfil}
  2122. %\global\setbox\pushcharbox = \hbox to 1em{\hfil$\dashv$\hfil}
  2123. %\global\setbox\equivbox = \hbox to 1em{\hfil$\ptexequiv$\hfil}
  2124. % Adapted from the manmac format (p.420 of TeXbook)
  2125. %\global\setbox\bullbox = \hbox to 1em{\kern.15em\vrule height .75ex width .85ex
  2126. %                                      depth .1ex\hfil}
  2127. \def\point{$\star$}
  2128. \def\result{\leavevmode\raise.15ex\hbox to 1em{\hfil$\Rightarrow$\hfil}}
  2129. \def\expansion{\leavevmode\raise.1ex\hbox to 1em{\hfil$\mapsto$\hfil}}
  2130. \def\print{\leavevmode\lower.1ex\hbox to 1em{\hfil$\dashv$\hfil}}
  2131. \def\equiv{\leavevmode\lower.1ex\hbox to 1em{\hfil$\ptexequiv$\hfil}}
  2132. % Adapted from the TeXbook's \boxit.
  2133. {\tentt \global\dimen0 = 3em}% Width of the box.
  2134. \dimen2 = .55pt % Thickness of rules
  2135. % The text. (`r' is open on the right, `e' somewhat less so on the left.)
  2136. \setbox0 = \hbox{\kern-.75pt \tensf error\kern-1.5pt}
  2137. \global\setbox\errorbox=\hbox to \dimen0{\hfil
  2138.    \hsize = \dimen0 \advance\hsize by -5.8pt % Space to left+right.
  2139.    \advance\hsize by -2\dimen2 % Rules.
  2140.    \vbox{
  2141.       \hrule height\dimen2
  2142.       \hbox{\vrule width\dimen2 \kern3pt          % Space to left of text.
  2143.          \vtop{\kern2.4pt \box0 \kern2.4pt}% Space above/below.
  2144.          \kern3pt\vrule width\dimen2}% Space to right.
  2145.       \hrule height\dimen2}
  2146.     \hfil}
  2147. % The @error{} command.
  2148. \def\error{\leavevmode\lower.7ex\copy\errorbox}
  2149. % @tex ... @end tex    escapes into raw Tex temporarily.
  2150. % One exception: @ is still an escape character, so that @end tex works.
  2151. % But \@ or @@ will get a plain tex @ character.
  2152. \def\tex{\begingroup
  2153. \catcode `\\=0 \catcode `\{=1 \catcode `\}=2
  2154. \catcode `\$=3 \catcode `\&=4 \catcode `\#=6
  2155. \catcode `\^=7 \catcode `\_=8 \catcode `\~=13 \let~=\tie
  2156. \catcode `\%=14
  2157. \catcode 43=12
  2158. \catcode`\"=12
  2159. \catcode`\==12
  2160. \catcode`\|=12
  2161. \catcode`\<=12
  2162. \catcode`\>=12
  2163. \escapechar=`\\
  2164. \let\{=\ptexlbrace
  2165. \let\}=\ptexrbrace
  2166. \let\.=\ptexdot
  2167. \let\*=\ptexstar
  2168. \let\dots=\ptexdots
  2169. \def\@{@}%
  2170. \let\bullet=\ptexbullet
  2171. \let\b=\ptexb \let\c=\ptexc \let\i=\ptexi \let\t=\ptext \let\l=\ptexl
  2172. \let\L=\ptexL
  2173. \let\Etex=\endgroup}
  2174. % Define @lisp ... @endlisp.
  2175. % @lisp does a \begingroup so it can rebind things,
  2176. % including the definition of @endlisp (which normally is erroneous).
  2177. % Amount to narrow the margins by for @lisp.
  2178. \newskip\lispnarrowing \lispnarrowing=0.4in
  2179. % This is the definition that ^M gets inside @lisp
  2180. % phr: changed space to \null, to avoid overfull hbox problems.
  2181. {\obeyspaces%
  2182. \gdef\lisppar{\null\endgraf}}
  2183. % Make each space character in the input produce a normal interword
  2184. % space in the output.  Don't allow a line break at this space, as this
  2185. % is used only in environments like @example, where each line of input
  2186. % should produce a line of output anyway.
  2187. {\obeyspaces %
  2188. \gdef\sepspaces{\obeyspaces\let =\tie}}
  2189. % Define \obeyedspace to be our active space, whatever it is.  This is
  2190. % for use in \parsearg.
  2191. {\sepspaces %
  2192. \global\let\obeyedspace= }
  2193. % This space is always present above and below environments.
  2194. \newskip\envskipamount \envskipamount = 0pt
  2195. % Make spacing and below environment symmetrical.
  2196. \def\aboveenvbreak{{\advance\envskipamount by \parskip
  2197. \endgraf \ifdim\lastskip<\envskipamount
  2198. \removelastskip \penalty-50 \vskip\envskipamount \fi}}
  2199. \let\afterenvbreak = \aboveenvbreak
  2200. % \nonarrowing is a flag.  If "set", @lisp etc don't narrow margins.
  2201. \let\nonarrowing=\relax
  2202. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  2203. % \cartouche: draw rectangle w/rounded corners around argument
  2204. \font\circle=lcircle10
  2205. \newdimen\circthick
  2206. \newdimen\cartouter\newdimen\cartinner
  2207. \newskip\normbskip\newskip\normpskip\newskip\normlskip
  2208. \circthick=\fontdimen8\circle
  2209. \def\ctl{{\circle\char'013\hskip -6pt}}% 6pt from pl file: 1/2charwidth
  2210. \def\ctr{{\hskip 6pt\circle\char'010}}
  2211. \def\cbl{{\circle\char'012\hskip -6pt}}
  2212. \def\cbr{{\hskip 6pt\circle\char'011}}
  2213. \def\carttop{\hbox to \cartouter{\hskip\lskip
  2214.     \ctl\leaders\hrule height\circthick\hfil\ctr
  2215.     \hskip\rskip}}
  2216. \def\cartbot{\hbox to \cartouter{\hskip\lskip
  2217.     \cbl\leaders\hrule height\circthick\hfil\cbr
  2218.     \hskip\rskip}}
  2219. \newskip\lskip\newskip\rskip
  2220. \long\def\cartouche{%
  2221. \begingroup
  2222.     \lskip=\leftskip \rskip=\rightskip
  2223.     \leftskip=0pt\rightskip=0pt %we want these *outside*.
  2224.     \cartinner=\hsize \advance\cartinner by-\lskip 
  2225.                \advance\cartinner by-\rskip
  2226.     \cartouter=\hsize
  2227.     \advance\cartouter by 18pt % allow for 3pt kerns on either
  2228. %                     side, and for 6pt waste from
  2229. %                     each corner char
  2230.     \normbskip=\baselineskip \normpskip=\parskip \normlskip=\lineskip
  2231.     % Flag to tell @lisp, etc., not to narrow margin.
  2232.     \let\nonarrowing=\comment
  2233.     \vbox\bgroup
  2234.         \baselineskip=0pt\parskip=0pt\lineskip=0pt
  2235.         \carttop
  2236.         \hbox\bgroup
  2237.             \hskip\lskip
  2238.             \vrule\kern3pt
  2239.             \vbox\bgroup
  2240.                 \hsize=\cartinner
  2241.                 \kern3pt
  2242.                 \begingroup
  2243.                     \baselineskip=\normbskip
  2244.                     \lineskip=\normlskip
  2245.                     \parskip=\normpskip
  2246.                     \vskip -\parskip
  2247. \def\Ecartouche{%
  2248.                 \endgroup
  2249.                 \kern3pt
  2250.             \egroup
  2251.             \kern3pt\vrule
  2252.             \hskip\rskip
  2253.         \egroup
  2254.         \cartbot
  2255.     \egroup
  2256. \endgroup
  2257. % This macro is called at the beginning of all the @example variants,
  2258. % inside a group.
  2259. \def\nonfillstart{%
  2260.   \aboveenvbreak
  2261.   \inENV % This group ends at the end of the body
  2262.   \hfuzz = 12pt % Don't be fussy
  2263.   \sepspaces % Make spaces be word-separators rather than space tokens.
  2264.   \singlespace % single space lines
  2265.   \let\par = \lisppar % don't ignore blank lines
  2266.   \obeylines % each line of input is a line of output
  2267.   \parskip = 0pt
  2268.   \parindent = 0pt
  2269.   \emergencystretch = 0pt % don't try to avoid overfull boxes
  2270.   % @cartouche defines \nonarrowing to inhibit narrowing
  2271.   % at next level down.
  2272.   \ifx\nonarrowing\relax
  2273.     \advance \leftskip by \lispnarrowing
  2274.     \exdentamount=\lispnarrowing
  2275.     \let\exdent=\nofillexdent
  2276.     \let\nonarrowing=\relax
  2277.   \fi
  2278. \def\Elisp{\endgroup\afterenvbreak}%
  2279. \def\lisp{\begingroup
  2280.   \nonfillstart
  2281.   \def\Elisp{\endgroup\afterenvbreak}%
  2282.   \tt
  2283.   \rawbackslash % output the \ character from the current font
  2284.   \gobble
  2285. % Define the \E... control sequence only if we are inside the
  2286. % environment, so the error checking in \end will work.
  2287. % We must call \lisp last in the definition, since it reads the
  2288. % return following the @example (or whatever) command.
  2289. \def\example{\begingroup \def\Eexample{\Elisp\endgroup}\lisp}
  2290. \def\smallexample{\begingroup \def\Esmallexample{\Elisp\endgroup}\lisp}
  2291. % Macro for 9 pt. examples, necessary to print with 5" lines.  From
  2292. % Pavel@xerox.  This is not used for @smallexamples unless the
  2293. % @smallbook command is given.
  2294. \def\smalllispx{\begingroup
  2295.   \nonfillstart
  2296.   \def\Esmalllisp{\endgroup\afterenvbreak}%
  2297.   % Smaller interline space and fonts for small examples.
  2298.   \baselineskip 10pt
  2299.   \indexfonts \tt
  2300.   \rawbackslash % output the \ character from the current font
  2301.   \gobble
  2302. % This is @display; same as @lisp except use roman font.
  2303. \def\display{\begingroup
  2304.   \nonfillstart
  2305.   \def\Edisplay{\endgroup\afterenvbreak}%
  2306.   \gobble
  2307. % This is @format; same as @display except don't narrow margins.
  2308. \def\format{\begingroup
  2309.   \let\nonarrowing = t
  2310.   \nonfillstart
  2311.   \def\Eformat{\endgroup\afterenvbreak}
  2312.   \gobble
  2313. % @flushleft (same as @format) and @flushright.
  2314. \def\flushleft{\begingroup
  2315.   \let\nonarrowing = t
  2316.   \nonfillstart
  2317.   \def\Eflushleft{\endgroup\afterenvbreak}%
  2318.   \gobble
  2319. \def\flushright{\begingroup
  2320.   \let\nonarrowing = t
  2321.   \nonfillstart
  2322.   \def\Eflushright{\endgroup\afterenvbreak}%
  2323.   \advance\leftskip by 0pt plus 1fill
  2324.   \gobble}
  2325. % @quotation does normal linebreaking and narrows the margins.
  2326. \def\quotation{%
  2327. \begingroup\inENV %This group ends at the end of the @quotation body
  2328. {\parskip=0pt  % because we will skip by \parskip too, later
  2329. \aboveenvbreak}%
  2330. \singlespace
  2331. \parindent=0pt
  2332. \def\Equotation{\par\endgroup\afterenvbreak}%
  2333. % @cartouche defines \nonarrowing to inhibit narrowing
  2334. % at next level down.
  2335. \ifx\nonarrowing\relax
  2336. \advance \leftskip by \lispnarrowing
  2337. \advance \rightskip by \lispnarrowing
  2338. \exdentamount=\lispnarrowing
  2339. \let\nonarrowing=\relax
  2340. \message{defuns,}
  2341. % Define formatter for defuns
  2342. % First, allow user to change definition object font (\df) internally
  2343. \def\setdeffont #1 {\csname DEF#1\endcsname}
  2344. \newskip\defbodyindent \defbodyindent=.4in
  2345. \newskip\defargsindent \defargsindent=50pt
  2346. \newskip\deftypemargin \deftypemargin=12pt
  2347. \newskip\deflastargmargin \deflastargmargin=18pt
  2348. \newcount\parencount
  2349. % define \functionparens, which makes ( and ) and & do special things.
  2350. % \functionparens affects the group it is contained in.
  2351. \def\activeparens{%
  2352. \catcode`\(=\active \catcode`\)=\active \catcode`\&=\active
  2353. \catcode`\[=\active \catcode`\]=\active}
  2354. % Make control sequences which act like normal parenthesis chars.
  2355. \let\lparen = ( \let\rparen = )
  2356. {\activeparens % Now, smart parens don't turn on until &foo (see \amprm)
  2357. % Be sure that we always have a definition for `(', etc.  For example,
  2358. % if the fn name has parens in it, \boldbrax will not be in effect yet,
  2359. % so TeX would otherwise complain about undefined control sequence.
  2360. \global\let(=\lparen \global\let)=\rparen
  2361. \global\let[=\lbrack \global\let]=\rbrack
  2362. \gdef\functionparens{\boldbrax\let&=\amprm\parencount=0 }
  2363. \gdef\boldbrax{\let(=\opnr\let)=\clnr\let[=\lbrb\let]=\rbrb}
  2364. % Definitions of (, ) and & used in args for functions.
  2365. % This is the definition of ( outside of all parentheses.
  2366. \gdef\oprm#1 {{\rm\char`\(}#1 \bf \let(=\opnested %
  2367. \global\advance\parencount by 1 }
  2368. % This is the definition of ( when already inside a level of parens.
  2369. \gdef\opnested{\char`\(\global\advance\parencount by 1 }
  2370. \gdef\clrm{% Print a paren in roman if it is taking us back to depth of 0.
  2371. % also in that case restore the outer-level definition of (.
  2372. \ifnum \parencount=1 {\rm \char `\)}\sl \let(=\oprm \else \char `\) \fi
  2373. \global\advance \parencount by -1 }
  2374. % If we encounter &foo, then turn on ()-hacking afterwards
  2375. \gdef\amprm#1 {{\rm\}\let(=\oprm \let)=\clrm\ }
  2376. \gdef\normalparens{\boldbrax\let&=\ampnr}
  2377. } % End of definition inside \activeparens
  2378. %% These parens (in \boldbrax) actually are a little bolder than the
  2379. %% contained text.  This is especially needed for [ and ]
  2380. \def\opnr{{\sf\char`\(}} \def\clnr{{\sf\char`\)}} \def\ampnr{\&}
  2381. \def\lbrb{{\bf\char`\[}} \def\rbrb{{\bf\char`\]}}
  2382. % First, defname, which formats the header line itself.
  2383. % #1 should be the function name.
  2384. % #2 should be the type of definition, such as "Function".
  2385. \def\defname #1#2{%
  2386. % Get the values of \leftskip and \rightskip as they were
  2387. % outside the @def...
  2388. \dimen2=\leftskip
  2389. \advance\dimen2 by -\defbodyindent
  2390. \dimen3=\rightskip
  2391. \advance\dimen3 by -\defbodyindent
  2392. \noindent        %
  2393. \setbox0=\hbox{\hskip \deflastargmargin{\rm #2}\hskip \deftypemargin}%
  2394. \dimen0=\hsize \advance \dimen0 by -\wd0 % compute size for first line
  2395. \dimen1=\hsize \advance \dimen1 by -\defargsindent %size for continuations
  2396. \parshape 2 0in \dimen0 \defargsindent \dimen1     %
  2397. % Now output arg 2 ("Function" or some such)
  2398. % ending at \deftypemargin from the right margin,
  2399. % but stuck inside a box of width 0 so it does not interfere with linebreaking
  2400. {% Adjust \hsize to exclude the ambient margins,
  2401. % so that \rightline will obey them.
  2402. \advance \hsize by -\dimen2 \advance \hsize by -\dimen3
  2403. \rlap{\rightline{{\rm #2}\hskip \deftypemargin}}}%
  2404. % Make all lines underfull and no complaints:
  2405. \tolerance=10000 \hbadness=10000    
  2406. \advance\leftskip by -\defbodyindent
  2407. \exdentamount=\defbodyindent
  2408. {\df #1}\enskip        % Generate function name
  2409. % Actually process the body of a definition
  2410. % #1 should be the terminating control sequence, such as \Edefun.
  2411. % #2 should be the "another name" control sequence, such as \defunx.
  2412. % #3 should be the control sequence that actually processes the header,
  2413. %    such as \defunheader.
  2414. \def\defparsebody #1#2#3{\begingroup\inENV% Environment for definitionbody
  2415. \medbreak %
  2416. % Define the end token that this defining construct specifies
  2417. % so that it will exit this group.
  2418. \def#1{\endgraf\endgroup\medbreak}%
  2419. \def#2{\begingroup\obeylines\activeparens\spacesplit#3}%
  2420. \parindent=0in
  2421. \advance\leftskip by \defbodyindent \advance \rightskip by \defbodyindent
  2422. \exdentamount=\defbodyindent
  2423. \begingroup %
  2424. \catcode 61=\active %
  2425. \obeylines\activeparens\spacesplit#3}
  2426. \def\defmethparsebody #1#2#3#4 {\begingroup\inENV %
  2427. \medbreak %
  2428. % Define the end token that this defining construct specifies
  2429. % so that it will exit this group.
  2430. \def#1{\endgraf\endgroup\medbreak}%
  2431. \def#2##1 {\begingroup\obeylines\activeparens\spacesplit{#3{##1}}}%
  2432. \parindent=0in
  2433. \advance\leftskip by \defbodyindent \advance \rightskip by \defbodyindent
  2434. \exdentamount=\defbodyindent
  2435. \begingroup\obeylines\activeparens\spacesplit{#3{#4}}}
  2436. \def\defopparsebody #1#2#3#4#5 {\begingroup\inENV %
  2437. \medbreak %
  2438. % Define the end token that this defining construct specifies
  2439. % so that it will exit this group.
  2440. \def#1{\endgraf\endgroup\medbreak}%
  2441. \def#2##1 ##2 {\def#4{##1}%
  2442. \begingroup\obeylines\activeparens\spacesplit{#3{##2}}}%
  2443. \parindent=0in
  2444. \advance\leftskip by \defbodyindent \advance \rightskip by \defbodyindent
  2445. \exdentamount=\defbodyindent
  2446. \begingroup\obeylines\activeparens\spacesplit{#3{#5}}}
  2447. % These parsing functions are similar to the preceding ones
  2448. % except that they do not make parens into active characters.
  2449. % These are used for "variables" since they have no arguments.
  2450. \def\defvarparsebody #1#2#3{\begingroup\inENV% Environment for definitionbody
  2451. \medbreak %
  2452. % Define the end token that this defining construct specifies
  2453. % so that it will exit this group.
  2454. \def#1{\endgraf\endgroup\medbreak}%
  2455. \def#2{\begingroup\obeylines\spacesplit#3}%
  2456. \parindent=0in
  2457. \advance\leftskip by \defbodyindent \advance \rightskip by \defbodyindent
  2458. \exdentamount=\defbodyindent
  2459. \begingroup %
  2460. \catcode 61=\active %
  2461. \obeylines\spacesplit#3}
  2462. \def\defvrparsebody #1#2#3#4 {\begingroup\inENV %
  2463. \medbreak %
  2464. % Define the end token that this defining construct specifies
  2465. % so that it will exit this group.
  2466. \def#1{\endgraf\endgroup\medbreak}%
  2467. \def#2##1 {\begingroup\obeylines\spacesplit{#3{##1}}}%
  2468. \parindent=0in
  2469. \advance\leftskip by \defbodyindent \advance \rightskip by \defbodyindent
  2470. \exdentamount=\defbodyindent
  2471. \begingroup\obeylines\spacesplit{#3{#4}}}
  2472. % This seems to work right in all cases.
  2473. \let\deftpparsebody=\defvrparsebody
  2474. % This fails to work.  When given `@deftp {Data Type} foo_t',
  2475. % it thinks the type name is just `f'.
  2476. %%% This is the same as all the others except for the last line.  We need
  2477. %%% to parse the arguments differently for @deftp, since the ``attributes''
  2478. %%% there are optional.
  2479. %%\def\deftpparsebody #1#2#3#4 {\begingroup\inENV %
  2480. %%\medbreak %
  2481. %%% Define the end token that this defining construct specifies
  2482. %%% so that it will exit this group.
  2483. %%\def#1{\endgraf\endgroup\medbreak}%
  2484. %%\def#2##1 {\begingroup\obeylines\spacesplit{#3{##1}}}%
  2485. %%\parindent=0in
  2486. %%\advance\leftskip by \defbodyindent \advance \rightskip by \defbodyindent
  2487. %%\exdentamount=\defbodyindent
  2488. %%\begingroup\obeylines\parsetpheaderline{#3{#4}}}
  2489. %%{\obeylines %
  2490. %%  % Parse the type name and any attributes (field names, etc.).
  2491. %%  % #1 is the beginning of the macro call that will produce the output,
  2492. %%  %   i.e., \deftpheader{CLASS}; this is passed from \deftpparsebody.
  2493. %%  % #2 is the type name, e.g., `struct termios'.
  2494. %%  % #3 is the (possibly empty) attribute list.
  2495. %%  % 
  2496. %%  \gdef\parsetpheaderline#1#2#3^^M{%
  2497. %%    \endgroup % Started in \deftpparsebody.
  2498. %%    %
  2499. %%    % If the attribute list is in fact empty, there will be no space after
  2500. %%    % #2; so we can't put a space in our TeX parameter list.  But if it
  2501. %%    % isn't empty, then #3 will begin with an unwanted space.
  2502. %%    \def\theargs{\ignorespaces #3}%
  2503. %%    %
  2504. %%    % Call the macro to produce the output.
  2505. %%    #1{#2}\theargs %
  2506. %%  }%
  2507. \def\defopvarparsebody #1#2#3#4#5 {\begingroup\inENV %
  2508. \medbreak %
  2509. % Define the end token that this defining construct specifies
  2510. % so that it will exit this group.
  2511. \def#1{\endgraf\endgroup\medbreak}%
  2512. \def#2##1 ##2 {\def#4{##1}%
  2513. \begingroup\obeylines\spacesplit{#3{##2}}}%
  2514. \parindent=0in
  2515. \advance\leftskip by \defbodyindent \advance \rightskip by \defbodyindent
  2516. \exdentamount=\defbodyindent
  2517. \begingroup\obeylines\spacesplit{#3{#5}}}
  2518. % Split up #2 at the first space token.
  2519. % call #1 with two arguments:
  2520. %  the first is all of #2 before the space token,
  2521. %  the second is all of #2 after that space token.
  2522. % If #2 contains no space token, all of it is passed as the first arg
  2523. % and the second is passed as empty.
  2524. {\obeylines
  2525. \gdef\spacesplit#1#2^^M{\endgroup\spacesplitfoo{#1}#2 \relax\spacesplitfoo}%
  2526. \long\gdef\spacesplitfoo#1#2 #3#4\spacesplitfoo{%
  2527. \ifx\relax #3%
  2528. #1{#2}{}\else #1{#2}{#3#4}\fi}}
  2529. % So much for the things common to all kinds of definitions.
  2530. % Define @defun.
  2531. % First, define the processing that is wanted for arguments of \defun
  2532. % Use this to expand the args and terminate the paragraph they make up
  2533. \def\defunargs #1{\functionparens \sl
  2534. % Expand, preventing hyphenation at `-' chars.
  2535. % Note that groups don't affect changes in \hyphenchar.
  2536. \hyphenchar\tensl=0
  2537. \hyphenchar\tensl=45
  2538. \ifnum\parencount=0 \else \errmessage{unbalanced parens in @def arguments}\fi%
  2539. \interlinepenalty=10000
  2540. \advance\rightskip by 0pt plus 1fil
  2541. \endgraf\penalty 10000\vskip -\parskip\penalty 10000%
  2542. \def\deftypefunargs #1{%
  2543. % Expand, preventing hyphenation at `-' chars.
  2544. % Note that groups don't affect changes in \hyphenchar.
  2545. \functionparens
  2546. \code{#1}%
  2547. \interlinepenalty=10000
  2548. \advance\rightskip by 0pt plus 1fil
  2549. \endgraf\penalty 10000\vskip -\parskip\penalty 10000%
  2550. % Do complete processing of one @defun or @defunx line already parsed.
  2551. % @deffn Command forward-char nchars
  2552. \def\deffn{\defmethparsebody\Edeffn\deffnx\deffnheader}
  2553. \def\deffnheader #1#2#3{\doind {fn}{\code{#2}}%
  2554. \begingroup\defname {#2}{#1}\defunargs{#3}\endgroup %
  2555. \catcode 61=\other % Turn off change made in \defparsebody
  2556. % @defun == @deffn Function
  2557. \def\defun{\defparsebody\Edefun\defunx\defunheader}
  2558. \def\defunheader #1#2{\doind {fn}{\code{#1}}% Make entry in function index
  2559. \begingroup\defname {#1}{Function}%
  2560. \defunargs {#2}\endgroup %
  2561. \catcode 61=\other % Turn off change made in \defparsebody
  2562. % @deftypefun int foobar (int @var{foo}, float @var{bar})
  2563. \def\deftypefun{\defparsebody\Edeftypefun\deftypefunx\deftypefunheader}
  2564. % #1 is the data type.  #2 is the name and args.
  2565. \def\deftypefunheader #1#2{\deftypefunheaderx{#1}#2 \relax}
  2566. % #1 is the data type, #2 the name, #3 the args.
  2567. \def\deftypefunheaderx #1#2 #3\relax{%
  2568. \doind {fn}{\code{#2}}% Make entry in function index
  2569. \begingroup\defname {\code{#1} #2}{Function}%
  2570. \deftypefunargs {#3}\endgroup %
  2571. \catcode 61=\other % Turn off change made in \defparsebody
  2572. % @deftypefn {Library Function} int foobar (int @var{foo}, float @var{bar})
  2573. \def\deftypefn{\defmethparsebody\Edeftypefn\deftypefnx\deftypefnheader}
  2574. % #1 is the classification.  #2 is the data type.  #3 is the name and args.
  2575. \def\deftypefnheader #1#2#3{\deftypefnheaderx{#1}{#2}#3 \relax}
  2576. % #1 is the classification, #2 the data type, #3 the name, #4 the args.
  2577. \def\deftypefnheaderx #1#2#3 #4\relax{%
  2578. \doind {fn}{\code{#3}}% Make entry in function index
  2579. \begingroup\defname {\code{#2} #3}{#1}%
  2580. \deftypefunargs {#4}\endgroup %
  2581. \catcode 61=\other % Turn off change made in \defparsebody
  2582. % @defmac == @deffn Macro
  2583. \def\defmac{\defparsebody\Edefmac\defmacx\defmacheader}
  2584. \def\defmacheader #1#2{\doind {fn}{\code{#1}}% Make entry in function index
  2585. \begingroup\defname {#1}{Macro}%
  2586. \defunargs {#2}\endgroup %
  2587. \catcode 61=\other % Turn off change made in \defparsebody
  2588. % @defspec == @deffn Special Form
  2589. \def\defspec{\defparsebody\Edefspec\defspecx\defspecheader}
  2590. \def\defspecheader #1#2{\doind {fn}{\code{#1}}% Make entry in function index
  2591. \begingroup\defname {#1}{Special Form}%
  2592. \defunargs {#2}\endgroup %
  2593. \catcode 61=\other % Turn off change made in \defparsebody
  2594. % This definition is run if you use @defunx
  2595. % anywhere other than immediately after a @defun or @defunx.
  2596. \def\deffnx #1 {\errmessage{@deffnx in invalid context}}
  2597. \def\defunx #1 {\errmessage{@defunx in invalid context}}
  2598. \def\defmacx #1 {\errmessage{@defmacx in invalid context}}
  2599. \def\defspecx #1 {\errmessage{@defspecx in invalid context}}
  2600. \def\deftypefnx #1 {\errmessage{@deftypefnx in invalid context}}
  2601. \def\deftypeunx #1 {\errmessage{@deftypeunx in invalid context}}
  2602. % @defmethod, and so on
  2603. % @defop {Funny Method} foo-class frobnicate argument
  2604. \def\defop #1 {\def\defoptype{#1}%
  2605. \defopparsebody\Edefop\defopx\defopheader\defoptype}
  2606. \def\defopheader #1#2#3{%
  2607. \dosubind {fn}{\code{#2}}{on #1}% Make entry in function index
  2608. \begingroup\defname {#2}{\defoptype{} on #1}%
  2609. \defunargs {#3}\endgroup %
  2610. % @defmethod == @defop Method
  2611. \def\defmethod{\defmethparsebody\Edefmethod\defmethodx\defmethodheader}
  2612. \def\defmethodheader #1#2#3{%
  2613. \dosubind {fn}{\code{#2}}{on #1}% entry in function index
  2614. \begingroup\defname {#2}{Method on #1}%
  2615. \defunargs {#3}\endgroup %
  2616. % @defcv {Class Option} foo-class foo-flag
  2617. \def\defcv #1 {\def\defcvtype{#1}%
  2618. \defopvarparsebody\Edefcv\defcvx\defcvarheader\defcvtype}
  2619. \def\defcvarheader #1#2#3{%
  2620. \dosubind {vr}{\code{#2}}{of #1}% Make entry in var index
  2621. \begingroup\defname {#2}{\defcvtype{} of #1}%
  2622. \defvarargs {#3}\endgroup %
  2623. % @defivar == @defcv {Instance Variable}
  2624. \def\defivar{\defvrparsebody\Edefivar\defivarx\defivarheader}
  2625. \def\defivarheader #1#2#3{%
  2626. \dosubind {vr}{\code{#2}}{of #1}% Make entry in var index
  2627. \begingroup\defname {#2}{Instance Variable of #1}%
  2628. \defvarargs {#3}\endgroup %
  2629. % These definitions are run if you use @defmethodx, etc.,
  2630. % anywhere other than immediately after a @defmethod, etc.
  2631. \def\defopx #1 {\errmessage{@defopx in invalid context}}
  2632. \def\defmethodx #1 {\errmessage{@defmethodx in invalid context}}
  2633. \def\defcvx #1 {\errmessage{@defcvx in invalid context}}
  2634. \def\defivarx #1 {\errmessage{@defivarx in invalid context}}
  2635. % Now @defvar
  2636. % First, define the processing that is wanted for arguments of @defvar.
  2637. % This is actually simple: just print them in roman.
  2638. % This must expand the args and terminate the paragraph they make up
  2639. \def\defvarargs #1{\normalparens #1%
  2640. \interlinepenalty=10000
  2641. \endgraf\penalty 10000\vskip -\parskip\penalty 10000}
  2642. % @defvr Counter foo-count
  2643. \def\defvr{\defvrparsebody\Edefvr\defvrx\defvrheader}
  2644. \def\defvrheader #1#2#3{\doind {vr}{\code{#2}}%
  2645. \begingroup\defname {#2}{#1}\defvarargs{#3}\endgroup}
  2646. % @defvar == @defvr Variable
  2647. \def\defvar{\defvarparsebody\Edefvar\defvarx\defvarheader}
  2648. \def\defvarheader #1#2{\doind {vr}{\code{#1}}% Make entry in var index
  2649. \begingroup\defname {#1}{Variable}%
  2650. \defvarargs {#2}\endgroup %
  2651. % @defopt == @defvr {User Option}
  2652. \def\defopt{\defvarparsebody\Edefopt\defoptx\defoptheader}
  2653. \def\defoptheader #1#2{\doind {vr}{\code{#1}}% Make entry in var index
  2654. \begingroup\defname {#1}{User Option}%
  2655. \defvarargs {#2}\endgroup %
  2656. % @deftypevar int foobar
  2657. \def\deftypevar{\defvarparsebody\Edeftypevar\deftypevarx\deftypevarheader}
  2658. % #1 is the data type.  #2 is the name.
  2659. \def\deftypevarheader #1#2{%
  2660. \doind {vr}{\code{#2}}% Make entry in variables index
  2661. \begingroup\defname {\code{#1} #2}{Variable}%
  2662. \interlinepenalty=10000
  2663. \endgraf\penalty 10000\vskip -\parskip\penalty 10000
  2664. \endgroup}
  2665. % @deftypevr {Global Flag} int enable
  2666. \def\deftypevr{\defvrparsebody\Edeftypevr\deftypevrx\deftypevrheader}
  2667. \def\deftypevrheader #1#2#3{\doind {vr}{\code{#3}}%
  2668. \begingroup\defname {\code{#2} #3}{#1}
  2669. \interlinepenalty=10000
  2670. \endgraf\penalty 10000\vskip -\parskip\penalty 10000
  2671. \endgroup}
  2672. % This definition is run if you use @defvarx
  2673. % anywhere other than immediately after a @defvar or @defvarx.
  2674. \def\defvrx #1 {\errmessage{@defvrx in invalid context}}
  2675. \def\defvarx #1 {\errmessage{@defvarx in invalid context}}
  2676. \def\defoptx #1 {\errmessage{@defoptx in invalid context}}
  2677. \def\deftypevarx #1 {\errmessage{@deftypevarx in invalid context}}
  2678. \def\deftypevrx #1 {\errmessage{@deftypevrx in invalid context}}
  2679. % Now define @deftp
  2680. % Args are printed in bold, a slight difference from @defvar.
  2681. \def\deftpargs #1{\bf \defvarargs{#1}}
  2682. % @deftp Class window height width ...
  2683. \def\deftp{\deftpparsebody\Edeftp\deftpx\deftpheader}
  2684. \def\deftpheader #1#2#3{\doind {tp}{\code{#2}}%
  2685. \begingroup\defname {#2}{#1}\deftpargs{#3}\endgroup}
  2686. % This definition is run if you use @deftpx, etc
  2687. % anywhere other than immediately after a @deftp, etc.
  2688. \def\deftpx #1 {\errmessage{@deftpx in invalid context}}
  2689. \message{cross reference,}
  2690. % Define cross-reference macros
  2691. \newwrite \auxfile
  2692. \newif\ifhavexrefs  % True if xref values are known.
  2693. \newif\ifwarnedxrefs  % True if we warned once that they aren't known.
  2694. % \setref{foo} defines a cross-reference point named foo.
  2695. \def\setref#1{%
  2696. %\dosetq{#1-title}{Ytitle}%
  2697. \dosetq{#1-pg}{Ypagenumber}%
  2698. \dosetq{#1-snt}{Ysectionnumberandtype}}
  2699. \def\unnumbsetref#1{%
  2700. %\dosetq{#1-title}{Ytitle}%
  2701. \dosetq{#1-pg}{Ypagenumber}%
  2702. \dosetq{#1-snt}{Ynothing}}
  2703. \def\appendixsetref#1{%
  2704. %\dosetq{#1-title}{Ytitle}%
  2705. \dosetq{#1-pg}{Ypagenumber}%
  2706. \dosetq{#1-snt}{Yappendixletterandtype}}
  2707. % \xref, \pxref, and \ref generate cross-references to specified points.
  2708. % For \xrefX, #1 is the node name, #2 the name of the Info
  2709. % cross-reference, #3 the printed node name, #4 the name of the Info
  2710. % file, #5 the name of the printed manual.  All but the node name can be
  2711. % omitted.
  2712. \def\pxref#1{see \xrefX[#1,,,,,,,]}
  2713. \def\xref#1{See \xrefX[#1,,,,,,,]}
  2714. \def\ref#1{\xrefX[#1,,,,,,,]}
  2715. \def\xrefX[#1,#2,#3,#4,#5,#6]{\begingroup%
  2716. \def\printedmanual{\ignorespaces #5}%
  2717. \def\printednodename{\ignorespaces #3}%
  2718. \setbox1=\hbox{\printedmanual}%
  2719. \setbox0=\hbox{\printednodename}%
  2720. \ifdim \wd0=0pt%
  2721. \def\printednodename{\ignorespaces #1}%
  2722. %%% Uncommment the following line to make the actual chapter or section title
  2723. %%% appear inside the square brackets.
  2724. %\def\printednodename{#1-title}%
  2725. % If we use \unhbox0 and \unhbox1 to print the node names, TeX does
  2726. % not insert empty discretionaries after hyphens, which means that it
  2727. % will not find a line break at a hyphen in a node names.  Since some
  2728. % manuals are best written with fairly long node names, containing
  2729. % hyphens, this is a loss.  Therefore, we simply give the text of
  2730. % the node name again, so it is as if TeX is seeing it for the first
  2731. % time.
  2732. \ifdim \wd1>0pt
  2733. section ``\printednodename'' in \cite{\printedmanual}%
  2734. \else%
  2735. \turnoffactive%
  2736. \refx{#1-snt}{} [\printednodename], page\tie\refx{#1-pg}{}%
  2737. \endgroup}
  2738. % \dosetq is the interface for calls from other macros
  2739. % Use \turnoffactive so that punctuation chars such as underscore
  2740. % work in node names.
  2741. \def\dosetq #1#2{{\let\folio=0 \turnoffactive%
  2742. \edef\next{\write\auxfile{\internalsetq {#1}{#2}}}%
  2743. \next}}
  2744. % \internalsetq {foo}{page} expands into
  2745. % CHARACTERS 'xrdef {foo}{...expansion of \Ypage...}
  2746. % When the aux file is read, ' is the escape character
  2747. \def\internalsetq #1#2{'xrdef {#1}{\csname #2\endcsname}}
  2748. % Things to be expanded by \internalsetq
  2749. \def\Ypagenumber{\folio}
  2750. \def\Ytitle{\thischapter}
  2751. \def\Ynothing{}
  2752. \def\Ysectionnumberandtype{%
  2753. \ifnum\secno=0 Chapter\xreftie\the\chapno %
  2754. \else \ifnum \subsecno=0 Section\xreftie\the\chapno.\the\secno %
  2755. \else \ifnum \subsubsecno=0 %
  2756. Section\xreftie\the\chapno.\the\secno.\the\subsecno %
  2757. \else %
  2758. Section\xreftie\the\chapno.\the\secno.\the\subsecno.\the\subsubsecno %
  2759. \fi \fi \fi }
  2760. \def\Yappendixletterandtype{%
  2761. \ifnum\secno=0 Appendix\xreftie'char\the\appendixno{}%
  2762. \else \ifnum \subsecno=0 Section\xreftie'char\the\appendixno.\the\secno %
  2763. \else \ifnum \subsubsecno=0 %
  2764. Section\xreftie'char\the\appendixno.\the\secno.\the\subsecno %
  2765. \else %
  2766. Section\xreftie'char\the\appendixno.\the\secno.\the\subsecno.\the\subsubsecno %
  2767. \fi \fi \fi }
  2768. \gdef\xreftie{'tie}
  2769. % Use TeX 3.0's \inputlineno to get the line number, for better error
  2770. % messages, but if we're using an old version of TeX, don't do anything.
  2771. \ifx\inputlineno\thisisundefined
  2772.   \let\linenumber = \empty % Non-3.0.
  2773. \else
  2774.   \def\linenumber{\the\inputlineno:\space}
  2775. % Define \refx{NAME}{SUFFIX} to reference a cross-reference string named NAME.
  2776. % If its value is nonempty, SUFFIX is output afterward.
  2777. \def\refx#1#2{%
  2778.   \expandafter\ifx\csname X#1\endcsname\relax
  2779.     % If not defined, say something at least.
  2780.     $\langle$un\-de\-fined$\rangle$%
  2781.     \ifhavexrefs
  2782.       \message{\linenumber Undefined cross reference `#1'.}%
  2783.     \else
  2784.       \ifwarnedxrefs\else
  2785.         \global\warnedxrefstrue
  2786.         \message{Cross reference values unknown; you must run TeX again.}%
  2787.       \fi
  2788.     \fi
  2789.   \else
  2790.     % It's defined, so just use it.
  2791.     \csname X#1\endcsname
  2792.   \fi
  2793.   #2% Output the suffix in any case.
  2794. % Read the last existing aux file, if any.  No error if none exists.
  2795. % This is the macro invoked by entries in the aux file.
  2796. \def\xrdef #1#2{
  2797. {\catcode`\'=\other\expandafter \gdef \csname X#1\endcsname {#2}}}
  2798. \def\readauxfile{%
  2799. \begingroup
  2800. \catcode `\^^@=\other
  2801. \catcode `\
  2802. =\other
  2803. \catcode `\
  2804. =\other
  2805. \catcode `\^^C=\other
  2806. \catcode `\^^D=\other
  2807. \catcode `\^^E=\other
  2808. \catcode `\^^F=\other
  2809. \catcode `\^^G=\other
  2810. \catcode `\^^H=\other
  2811. \catcode `\
  2812. =\other
  2813. \catcode `\^^L=\other
  2814. \catcode `\
  2815. =\other
  2816. \catcode `\
  2817. =\other
  2818. \catcode `\
  2819. =\other
  2820. \catcode `\
  2821. =\other
  2822. \catcode `\
  2823. =\other
  2824. \catcode `\
  2825. =\other
  2826. \catcode `\
  2827. =\other
  2828. \catcode `\
  2829. =\other
  2830. \catcode `\
  2831. =\other
  2832. \catcode `\
  2833. =\other
  2834. \catcode `\
  2835. =\other
  2836. \catcode `\
  2837. =\other
  2838. \catcode 26=\other
  2839. \catcode `\^^[=\other
  2840. \catcode `\^^\=\other
  2841. \catcode `\^^]=\other
  2842. \catcode `\^^^=\other
  2843. \catcode `\^^_=\other
  2844. \catcode `\@=\other
  2845. \catcode `\^=\other
  2846. \catcode `\~=\other
  2847. \catcode `\[=\other
  2848. \catcode `\]=\other
  2849. \catcode`\"=\other
  2850. \catcode`\_=\other
  2851. \catcode`\|=\other
  2852. \catcode`\<=\other
  2853. \catcode`\>=\other
  2854. \catcode `\$=\other
  2855. \catcode `\#=\other
  2856. \catcode `\&=\other
  2857. % `\+ does not work, so use 43.
  2858. \catcode 43=\other
  2859. % the aux file uses ' as the escape.
  2860. % Turn off \ as an escape so we do not lose on
  2861. % entries which were dumped with control sequences in their names.
  2862. % For example, 'xrdef {$\leq $-fun}{page ...} made by @defun ^^
  2863. % Reference to such entries still does not work the way one would wish,
  2864. % but at least they do not bomb out when the aux file is read in.
  2865. \catcode `\{=1 \catcode `\}=2
  2866. \catcode `\%=\other
  2867. \catcode `\'=0
  2868. \catcode `\\=\other
  2869. \openin 1 \jobname.aux
  2870. \ifeof 1 \else \closein 1 \input \jobname.aux \global\havexrefstrue
  2871. \global\warnedobstrue
  2872. % Open the new aux file.  Tex will close it automatically at exit.
  2873. \openout \auxfile=\jobname.aux
  2874. \endgroup}
  2875. % Footnotes.
  2876. \newcount \footnoteno
  2877. % The trailing space in the following definition for supereject is
  2878. % vital for proper filling; pages come out unaligned when you do a
  2879. % pagealignmacro call if that space before the closing brace is
  2880. % removed.
  2881. \def\supereject{\par\penalty -20000\footnoteno =0 }
  2882. % @footnotestyle is meaningful for info output only..
  2883. \let\footnotestyle=\comment
  2884. \let\ptexfootnote=\footnote
  2885. {\catcode `\@=11
  2886. % Auto-number footnotes.  Otherwise like plain.
  2887. \gdef\footnote{%
  2888.   \global\advance\footnoteno by \@ne
  2889.   \edef\thisfootno{$^{\the\footnoteno}$}%
  2890.   % In case the footnote comes at the end of a sentence, preserve the
  2891.   % extra spacing after we do the footnote number.
  2892.   \let\@sf\empty
  2893.   \ifhmode\edef\@sf{\spacefactor\the\spacefactor}\/\fi
  2894.   % Remove inadvertent blank space before typesetting the footnote number.
  2895.   \unskip
  2896.   \thisfootno\@sf
  2897.   \footnotezzz
  2898. % Don't bother with the trickery in plain.tex to not require the
  2899. % footnote text as a parameter.  Our footnotes don't need to be so general.
  2900. \long\gdef\footnotezzz#1{\insert\footins{%
  2901.   % We want to typeset this text as a normal paragraph, even if the
  2902.   % footnote reference occurs in (for example) a display environment.
  2903.   % So reset some parameters.
  2904.   \interlinepenalty\interfootnotelinepenalty
  2905.   \splittopskip\ht\strutbox % top baseline for broken footnotes
  2906.   \splitmaxdepth\dp\strutbox
  2907.   \floatingpenalty\@MM
  2908.   \leftskip\z@skip
  2909.   \rightskip\z@skip
  2910.   \spaceskip\z@skip
  2911.   \xspaceskip\z@skip
  2912.   \parindent\defaultparindent
  2913.   % Hang the footnote text off the number.
  2914.   \hang
  2915.   \textindent{\thisfootno}%
  2916.   % Don't crash into the line above the footnote text.  Since this
  2917.   % expands into a box, it must come within the paragraph, lest it
  2918.   % provide a place where TeX can split the footnote.
  2919.   \footstrut
  2920.   #1\strut}%
  2921. }%end \catcode `\@=11
  2922. % Set the baselineskip to #1, and the lineskip and strut size
  2923. % correspondingly.  There is no deep meaning behind these magic numbers
  2924. % used as factors; they just match (closely enough) what Knuth defined.
  2925. \def\lineskipfactor{.1}
  2926. \def\strutheightpercent{.71}
  2927. \def\strutdepthpercent{.29}
  2928. \def\setleading#1{%
  2929.   \baselineskip = #1\relax
  2930.   \normalbaselineskip = \baselineskip
  2931.   \lineskip = \lineskipfactor\baselineskip
  2932.   \setbox\strutbox =\hbox{%
  2933.     \vrule width0pt height\strutheightpercent\baselineskip
  2934.                     depth \strutdepthpercent \baselineskip
  2935. % @| inserts a changebar to the left of the current line.  It should
  2936. % surround any changed text.  This approach does *not* work if the
  2937. % change spans more than two lines of output.  To handle that, we would
  2938. % have adopt a much more difficult approach (putting marks into the main
  2939. % vertical list for the beginning and end of each change).
  2940. \def\|{%
  2941.   % \vadjust can only be used in horizontal mode.
  2942.   \leavevmode
  2943.   % Append this vertical mode material after the current line in the output.
  2944.   \vadjust{%
  2945.     % We want to insert a rule with the height and depth of the current
  2946.     % leading; that is exactly what \strutbox is supposed to record.
  2947.     \vskip-\baselineskip
  2948.     %
  2949.     % \vadjust-items are inserted at the left edge of the type.  So
  2950.     % the \llap here moves out into the left-hand margin.
  2951.     \llap{%
  2952.       %
  2953.       % For a thicker or thinner bar, change the `1pt'.
  2954.       \vrule height\baselineskip width1pt
  2955.       %
  2956.       % This is the space between the bar and the text.
  2957.       \hskip 12pt
  2958.     }%
  2959. % For a final copy, take out the rectangles
  2960. % that mark overfull boxes (in case you have decided
  2961. % that the text looks ok even though it passes the margin).
  2962. \def\finalout{\overfullrule=0pt}
  2963. % End of control word definitions.
  2964. \message{and turning on texinfo input format.}
  2965. \def\openindices{%
  2966.    \newindex{cp}%
  2967.    \newcodeindex{fn}%
  2968.    \newcodeindex{vr}%
  2969.    \newcodeindex{tp}%
  2970.    \newcodeindex{ky}%
  2971.    \newcodeindex{pg}%
  2972. % Set some numeric style parameters, for 8.5 x 11 format.
  2973. %\hsize = 6.5in
  2974. \newdimen\defaultparindent \defaultparindent = 15pt
  2975. \parindent = \defaultparindent
  2976. \parskip 18pt plus 1pt
  2977. \setleading{15pt}
  2978. \advance\topskip by 1.2cm
  2979. % Prevent underfull vbox error messages.
  2980. \vbadness=10000
  2981. % Following George Bush, just get rid of widows and orphans.
  2982. \widowpenalty=10000
  2983. \clubpenalty=10000
  2984. % Use TeX 3.0's \emergencystretch to help line breaking, but if we're
  2985. % using an old version of TeX, don't do anything.  We want the amount of
  2986. % stretch added to depend on the line length, hence the dependence on
  2987. % \hsize.  This makes it come to about 9pt for the 8.5x11 format.
  2988. \ifx\emergencystretch\thisisundefined
  2989.   % Allow us to assign to \emergencystretch anyway.
  2990.   \def\emergencystretch{\dimen0}%
  2991. \else
  2992.   \emergencystretch = \hsize
  2993.   \divide\emergencystretch by 45
  2994. % Use @smallbook to reset parameters for 7x9.5 format  (or else 7x9.25)
  2995. \def\smallbook{
  2996. % These values for secheadingskip and subsecheadingskip are
  2997. % experiments.  RJC 7 Aug 1992
  2998. \global\secheadingskip = 17pt plus 6pt minus 3pt
  2999. \global\subsecheadingskip = 14pt plus 6pt minus 3pt
  3000. \global\lispnarrowing = 0.3in
  3001. \setleading{12pt}
  3002. \advance\topskip by -1cm
  3003. \global\parskip 3pt plus 1pt
  3004. \global\hsize = 5in
  3005. \global\vsize=7.5in
  3006. \global\tolerance=700
  3007. \global\hfuzz=1pt
  3008. \global\contentsrightmargin=0pt
  3009. \global\pagewidth=\hsize
  3010. \global\pageheight=\vsize
  3011. \global\let\smalllisp=\smalllispx
  3012. \global\let\smallexample=\smalllispx
  3013. \global\def\Esmallexample{\Esmalllisp}
  3014. % Use @afourpaper to print on European A4 paper.
  3015. \def\afourpaper{
  3016. \global\tolerance=700
  3017. \global\hfuzz=1pt
  3018. \setleading{12pt}
  3019. \global\parskip 15pt plus 1pt
  3020. \global\vsize= 53\baselineskip
  3021. \advance\vsize by \topskip
  3022. %\global\hsize=   5.85in     % A4 wide 10pt
  3023. \global\hsize=  6.5in
  3024. \global\outerhsize=\hsize
  3025. \global\advance\outerhsize by 0.5in
  3026. \global\outervsize=\vsize
  3027. \global\advance\outervsize by 0.6in
  3028. \global\pagewidth=\hsize
  3029. \global\pageheight=\vsize
  3030. % Define macros to output various characters with catcode for normal text.
  3031. \catcode`\"=\other
  3032. \catcode`\~=\other
  3033. \catcode`\^=\other
  3034. \catcode`\_=\other
  3035. \catcode`\|=\other
  3036. \catcode`\<=\other
  3037. \catcode`\>=\other
  3038. \catcode`\+=\other
  3039. \def\normaldoublequote{"}
  3040. \def\normaltilde{~}
  3041. \def\normalcaret{^}
  3042. \def\normalunderscore{_}
  3043. \def\normalverticalbar{|}
  3044. \def\normalless{<}
  3045. \def\normalgreater{>}
  3046. \def\normalplus{+}
  3047. % This macro is used to make a character print one way in ttfont
  3048. % where it can probably just be output, and another way in other fonts,
  3049. % where something hairier probably needs to be done.
  3050. % #1 is what to print if we are indeed using \tt; #2 is what to print
  3051. % otherwise.  Since all the Computer Modern typewriter fonts have zero
  3052. % interword stretch (and shrink), and it is reasonable to expect all
  3053. % typewriter fonts to have this, we can check that font parameter.
  3054. \def\ifusingtt#1#2{\ifdim \fontdimen3\the\font=0pt #1\else #2\fi}
  3055. % Turn off all special characters except @
  3056. % (and those which the user can use as if they were ordinary).
  3057. % Most of these we simply print from the \tt font, but for some, we can
  3058. % use math or other variants that look better in normal text.
  3059. \catcode`\"=\active
  3060. \def\activedoublequote{{\tt \char '042}}
  3061. \let"=\activedoublequote
  3062. \catcode`\~=\active
  3063. \def~{{\tt \char '176}}
  3064. \chardef\hat=`\^
  3065. \catcode`\^=\active
  3066. \def^{{\tt \hat}}
  3067. \catcode`\_=\active
  3068. \def_{\ifusingtt\normalunderscore\_}
  3069. % Subroutine for the previous macro.
  3070. \def\_{\lvvmode \kern.06em \vbox{\hrule width.3em height.1ex}}
  3071. % \lvvmode is equivalent in function to \leavevmode.
  3072. % Using \leavevmode runs into trouble when written out to
  3073. % an index file due to the expansion of \leavevmode into ``\unhbox
  3074. % \voidb@x'' ---which looks to TeX like ``\unhbox \voidb\x'' due to our
  3075. % magic tricks with @.
  3076. \def\lvvmode{\vbox to 0pt{}}
  3077. \catcode`\|=\active
  3078. \def|{{\tt \char '174}}
  3079. \chardef \less=`\<
  3080. \catcode`\<=\active
  3081. \def<{{\tt \less}}
  3082. \chardef \gtr=`\>
  3083. \catcode`\>=\active
  3084. \def>{{\tt \gtr}}
  3085. \catcode`\+=\active
  3086. \def+{{\tt \char 43}}
  3087. %\catcode 27=\active
  3088. %\def^^[{$\diamondsuit$}
  3089. % Used sometimes to turn off (effectively) the active characters
  3090. % even after parsing them.
  3091. \def\turnoffactive{\let"=\normaldoublequote
  3092. \let~=\normaltilde
  3093. \let^=\normalcaret
  3094. \let_=\normalunderscore
  3095. \let|=\normalverticalbar
  3096. \let<=\normalless
  3097. \let>=\normalgreater
  3098. \let+=\normalplus}
  3099. % Set up an active definition for =, but don't enable it most of the time.
  3100. {\catcode`\==\active
  3101. \global\def={{\tt \char 61}}}
  3102. \catcode`\@=0
  3103. % \rawbackslashxx output one backslash character in current font
  3104. \global\chardef\rawbackslashxx=`\\
  3105. %{\catcode`\\=\other
  3106. %@gdef@rawbackslashxx{\}}
  3107. % \rawbackslash redefines \ as input to do \rawbackslashxx.
  3108. {\catcode`\\=\active
  3109. @gdef@rawbackslash{@let\=@rawbackslashxx }}
  3110. % \normalbackslash outputs one backslash in fixed width font.
  3111. \def\normalbackslash{{\tt\rawbackslashxx}}
  3112. % Say @foo, not \foo, in error messages.
  3113. \escapechar=`\@
  3114. % \catcode 17=0   % Define control-q
  3115. \catcode`\\=\active
  3116. % If a .fmt file is being used, we don't want the `\input texinfo' to show up.
  3117. % That is what \eatinput is for; after that, the `\' should revert to printing 
  3118. % a backslash.
  3119. @gdef@eatinput input texinfo{@fixbackslash}
  3120. @global@let\ = @eatinput
  3121. % On the other hand, perhaps the file did not have a `\input texinfo'. Then
  3122. % the first `\{ in the file would cause an error. This macro tries to fix 
  3123. % that, assuming it is called before the first `\' could plausibly occur.
  3124. @gdef@fixbackslash{@ifx\@eatinput @let\ = @normalbackslash @fi}
  3125. %% These look ok in all fonts, so just make them not special.  The @rm below
  3126. %% makes sure that the current font starts out as the newly loaded cmr10
  3127. @catcode`@$=@other @catcode`@%=@other @catcode`@&=@other @catcode`@#=@other
  3128. @textfonts
  3129. @c Local variables:
  3130. @c page-delimiter: "^\\\\message"
  3131. @c End:
  3132.